Re: [PATCH v3 13/23] irqchip: Add driver for the RPMI system MSI service group

Anup Patel
2025-05-21T11:37:43Z

On Tue, May 13, 2025 at 12:28 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>
> On Sun, May 11 2025 at 19:09, Anup Patel wrote:
> > +static int rpmi_sysmsi_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct rpmi_sysmsi_priv *priv;
> > + int rc;
> > +
> > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > + if (!priv)
> > + return -ENOMEM;
> > + priv->dev = dev;
> > + platform_set_drvdata(pdev, priv);
> > +
> > + /* Setup mailbox client */
> > + priv->client.dev = priv->dev;
> > + priv->client.rx_callback = NULL;
> > + priv->client.tx_block = false;
> > + priv->client.knows_txdone = true;
> > + priv->client.tx_tout = 0;
> > +
> > + /* Request mailbox channel */
> > + priv->chan = mbox_request_channel(&priv->client, 0);
> > + if (IS_ERR(priv->chan))
> > + return PTR_ERR(priv->chan);
> > +
> > + /* Get number of system MSIs */
> > + rc = rpmi_sysmsi_get_num_msi(priv);
> > + if (rc < 1) {
> > + mbox_free_channel(priv->chan);
> > + return dev_err_probe(dev, -ENODEV, "No system MSIs found\n");
> > + }
> > + priv->nr_irqs = rc;
> > +
> > + /* Set the device MSI domain if not available */
> > + if (!dev_get_msi_domain(dev)) {
> > + /*
> > + * The device MSI domain for OF devices is only set at the
> > + * time of populating/creating OF device. If the device MSI
> > + * domain is discovered later after the OF device is created
> > + * then we need to set it explicitly before using any platform
> > + * MSI functions.
> > + */
> > + if (is_of_node(dev_fwnode(dev)))
> > + of_msi_configure(dev, to_of_node(dev_fwnode(dev)));
> > +
> > + if (!dev_get_msi_domain(dev))
> > + return -EPROBE_DEFER;
>
> This leaks the channel.

Ahh yes, I will update.

>
> > + }
> > +
> > + if (!msi_create_device_irq_domain(dev, MSI_DEFAULT_DOMAIN,
> > + &rpmi_sysmsi_template,
> > + priv->nr_irqs, priv, priv))
> > + return dev_err_probe(dev, -ENOMEM, "failed to create MSI irq domain\n");
>
> Ditto.
>
> Thanks,
>
> tglx

Thanks,
Anup