[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zffhk66f.ffs@tglx>
Date: Mon, 12 May 2025 20:58:00 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Anup Patel <apatel@...tanamicro.com>, Michael Turquette
<mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>, Rob Herring
<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Jassi Brar <jassisinghbrar@...il.com>, "Rafael J .
Wysocki" <rafael@...nel.org>, Mika Westerberg
<mika.westerberg@...ux.intel.com>, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com>, Linus Walleij
<linus.walleij@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>, Uwe
Kleine-König <ukleinek@...nel.org>
Cc: Palmer Dabbelt <palmer@...belt.com>, Paul Walmsley
<paul.walmsley@...ive.com>, Len Brown <lenb@...nel.org>, Sunil V L
<sunilvl@...tanamicro.com>, Rahul Pathak <rpathak@...tanamicro.com>,
Leyfoon Tan <leyfoon.tan@...rfivetech.com>, Atish Patra
<atish.patra@...ux.dev>, Andrew Jones <ajones@...tanamicro.com>, Samuel
Holland <samuel.holland@...ive.com>, Anup Patel <anup@...infault.org>,
linux-clk@...r.kernel.org, devicetree@...r.kernel.org,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org, Anup Patel
<apatel@...tanamicro.com>
Subject: Re: [PATCH v3 13/23] irqchip: Add driver for the RPMI system MSI
service group
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.
> + }
> +
> + 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
Powered by blists - more mailing lists