From: Khalid Aziz <khalid@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Rakuram Eswaran" <rakuram.e96@gmail.com>
Cc: chenhuacai@kernel.org, dan.carpenter@linaro.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: Fri, 10 Oct 2025 11:59:57 -0600 [thread overview]
Message-ID: <3a73daeb-1353-463d-a1f1-22cdece1326b@kernel.org> (raw)
In-Reply-To: <aliep4j5jmbdixu5cmqztoxwp3jv4r4hi63qpvhughepsepzb3@qh3mwgryf5ny>
On 10/10/25 3:59 AM, Uwe Kleine-König wrote:
> Hello Rakuram,
>
> On Thu, Oct 09, 2025 at 08:57:38PM +0530, Rakuram Eswaran wrote:
>> Your suggestion makes perfect sense — since host is devm-managed,
>> explicitly assigning its members to NULL has no effect.
>> I’ll remove those two redundant lines in v2 as you suggested.
>>
>> I had one small clarification regarding the remaining host->dma_chan_tx = NULL;
>> in the TX DMA error path. Since that branch uses goto out,
>> the cleanup section below may call dma_release_channel() on both RX
>> and TX pointers. Setting TX to NULL there seems like a defensive step
>> to avoid accidentally passing an ERR_PTR() to dma_release_channel()
>> — is that understanding correct?
>
> Ah right, so either keep host->dma_chan_tx = NULL or improve the error
> handling like:
>
> diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
> index 26d03352af63..e5068cc55fb2 100644
> --- a/drivers/mmc/host/pxamci.c
> +++ b/drivers/mmc/host/pxamci.c
> @@ -715,7 +715,7 @@ static int pxamci_probe(struct platform_device *pdev)
> dev_err(dev, "unable to request tx dma channel\n");
> ret = PTR_ERR(host->dma_chan_tx);
> host->dma_chan_tx = NULL;
> - goto out;
> + goto out_dma_tx;
> }
>
> if (host->pdata) {
> @@ -765,10 +765,11 @@ static int pxamci_probe(struct platform_device *pdev)
> return 0;
>
> out:
> - if (host->dma_chan_rx)
> - dma_release_channel(host->dma_chan_rx);
> if (host->dma_chan_tx)
> dma_release_channel(host->dma_chan_tx);
> +out_dma_tx:
> + if (host->dma_chan_rx)
> + dma_release_channel(host->dma_chan_rx);
> return ret;
> }
I do not see the need for this code change. "if (host->dma_chan_tx)"
will skip "dma_release_channel(host->dma_chan_tx)" since dma_chan_tx is
already NULL. This code change does not add anything.
--
Khalid
>
>> Also, I noticed that in the build configuration downloaded from the LKP report
>> link (CONFIG_DMA_ENGINE isn’t defined), the kernel uses the stub inline
>> version of dma_release_channel() from include/linux/dmaengine.h,
>> which becomes a no-op.
>>
>> From what I understand, when the DMA engine framework isn’t enabled,
>> these APIs compile as no-ops through their inline stubs.
>> Please correct me if I’m misunderstanding how this works.
>>
>> Please let me know if this reasoning aligns with what you had in mind.
>
> Sounds right.
>
> Best regards
> Uwe
next prev parent reply other threads:[~2025-10-10 17:59 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 [this message]
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
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=3a73daeb-1353-463d-a1f1-22cdece1326b@kernel.org \
--to=khalid@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=david.hunter.linux@gmail.com \
--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