From: Dan Carpenter <dan.carpenter@linaro.org>
To: Khalid Aziz <khalid@kernel.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Rakuram Eswaran" <rakuram.e96@gmail.com>,
chenhuacai@kernel.org, david.hunter.linux@gmail.com,
linux-kernel-mentees@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
lkp@intel.com, skhan@linuxfoundation.org, ulf.hansson@linaro.org,
zhoubinbin@loongson.cn
Subject: Re: [PATCH] mmc: pxamci: Fix passing NULL to PTR_ERR() in pxamci_probe()
Date: Tue, 14 Oct 2025 15:27:11 +0300 [thread overview]
Message-ID: <aO5BnwkNNyv_GOGS@stanley.mountain> (raw)
In-Reply-To: <8afff048-4fe1-440a-9739-e5a5ea43d6eb@kernel.org>
On Mon, Oct 13, 2025 at 04:54:13PM -0600, Khalid Aziz wrote:
> > @@ -703,20 +705,15 @@ static int pxamci_probe(struct platform_device *pdev)
> > platform_set_drvdata(pdev, mmc);
> > - host->dma_chan_rx = dma_request_chan(dev, "rx");
> > - if (IS_ERR(host->dma_chan_rx)) {
> > - host->dma_chan_rx = NULL;
> > + host->dma_chan_rx = devm_dma_request_chan(dev, "rx");
> > + if (IS_ERR(host->dma_chan_rx))
> > return dev_err_probe(dev, PTR_ERR(host->dma_chan_rx),
> > "unable to request rx dma channel\n");
> > - }
> > - host->dma_chan_tx = dma_request_chan(dev, "tx");
> > - if (IS_ERR(host->dma_chan_tx)) {
> > - dev_err(dev, "unable to request tx dma channel\n");
> > - ret = PTR_ERR(host->dma_chan_tx);
> > - host->dma_chan_tx = NULL;
> > - goto out;
> > - }
> > + host->dma_chan_tx = devm_dma_request_chan(dev, "tx");
> > + if (IS_ERR(host->dma_chan_tx))
> > + return dev_err_probe(dev, PTR_ERR(host->dma_chan_tx),
> > + "unable to request tx dma channel\n");
>
> We should still release DMA rx channel before returning here.
>
> > if (host->pdata) {
> > host->detect_delay_ms = host->pdata->detect_delay_ms;
> > @@ -724,25 +721,21 @@ static int pxamci_probe(struct platform_device *pdev)
> > host->power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
> > if (IS_ERR(host->power)) {
> > ret = PTR_ERR(host->power);
> > - dev_err(dev, "Failed requesting gpio_power\n");
> > - goto out;
> > + return dev_err_probe(dev, ret, "Failed requesting gpio_power\n");
>
> Don't we need to release DMA Rx and Tx channels before we return from here?
>
> > }
> > /* FIXME: should we pass detection delay to debounce? */
> > ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0);
> > - if (ret && ret != -ENOENT) {
> > - dev_err(dev, "Failed requesting gpio_cd\n");
> > - goto out;
> > - }
> > + if (ret && ret != -ENOENT)
> > + return dev_err_probe(dev, ret, "Failed requesting gpio_cd\n");
>
> Same here
>
> > if (!host->pdata->gpio_card_ro_invert)
> > mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
> > ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0);
> > - if (ret && ret != -ENOENT) {
> > - dev_err(dev, "Failed requesting gpio_ro\n");
> > - goto out;
> > - }
> > + if (ret && ret != -ENOENT)
> > + return dev_err_probe(dev, ret, "Failed requesting gpio_ro\n");
>
> and here.
>
> Looking at Documentation/driver-api/driver-model/devres.rst,
> dma_request_chan() is not devres managed interface and thus will not be
> released automatically. Do you agree?
>
The patch changes dma_request_chan() to devm_dma_request_chan().
regards,
dan carpenter
next prev parent reply other threads:[~2025-10-14 12:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 16:17 [PATCH] mmc: pxamci: Fix passing NULL to PTR_ERR() in pxamci_probe() Rakuram Eswaran
2025-10-07 16:40 ` Dan Carpenter
2025-10-07 17:43 ` Khalid Aziz
2025-10-09 1:21 ` Binbin Zhou
2025-10-09 8:57 ` Uwe Kleine-König
2025-10-09 15:27 ` Rakuram Eswaran
2025-10-10 9:59 ` Uwe Kleine-König
2025-10-10 17:59 ` Khalid Aziz
2025-10-12 14:15 ` Uwe Kleine-König
2025-10-12 18:37 ` Rakuram Eswaran
2025-10-13 8:45 ` Uwe Kleine-König
2025-10-13 22:54 ` Khalid Aziz
2025-10-14 12:27 ` Dan Carpenter [this message]
2025-10-14 13:31 ` Khalid Aziz
2025-10-14 18:49 ` Rakuram Eswaran
2025-10-09 15:53 ` Khalid Aziz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aO5BnwkNNyv_GOGS@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=chenhuacai@kernel.org \
--cc=david.hunter.linux@gmail.com \
--cc=khalid@kernel.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=lkp@intel.com \
--cc=rakuram.e96@gmail.com \
--cc=skhan@linuxfoundation.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=ulf.hansson@linaro.org \
--cc=zhoubinbin@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox