From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: linux-ide@vger.kernel.org, dlemoal@kernel.org, cassel@kernel.org
Subject: Re: [PATCH] ata: Remove redundant dev_err()
Date: Fri, 10 Jul 2026 11:15:46 +0000 [thread overview]
Message-ID: <20260710111547.1C3061F01559@smtp.kernel.org> (raw)
In-Reply-To: <20260710110247.426444-1-panchuang@vivo.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Double Free of IRQ Mapping
- [High] Memory Leak of irqaction (Devres Conflict)
--
--- Patch [1]: [PATCH] ata: Remove redundant dev_err() ---
commit c11d795c8457981d78fb45735e5126724a48c0df
Author: Pan Chuang <panchuang@vivo.com>
ata: Remove redundant dev_err()
Since devm_request_irq() automatically logs error messages on failure,
this commit removes the redundant driver-specific dev_err() call from
the probe path.
> diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
> index 210a63283f62b..1739743427cfc 100644
> --- a/drivers/ata/pata_mpc52xx.c
> +++ b/drivers/ata/pata_mpc52xx.c
> @@ -769,10 +769,8 @@ static int mpc52xx_ata_probe(struct platform_device *op)
> task_irq = bcom_get_task_irq(dmatsk);
> rv = devm_request_irq(&op->dev, task_irq, &mpc52xx_ata_task_irq, 0,
> "ATA task", priv);
> - if (rv) {
> - dev_err(&op->dev, "error requesting DMA IRQ\n");
> + if (rv)
> goto err2;
[Severity: High]
This is a pre-existing issue, but I noticed a potential double free of the
IRQ mapping and a memory leak related to this error path.
If devm_request_irq() fails, the code jumps to the err2 label:
err2:
irq_dispose_mapping(task_irq);
bcom_ata_release(dmatsk);
Does this cause a double free of the IRQ mapping? The bcom_ata_release()
function internally calls bcom_task_free(), which also unconditionally calls
irq_dispose_mapping(tsk->irq) on the same task_irq.
Additionally, can these manual irq_dispose_mapping() calls in the err1 and err2
paths (and similarly in mpc52xx_ata_remove()) cause the irqaction structures
to leak?
Because devm_request_irq() is used, the devres cleanup runs after the probe
function returns. If the IRQ mapping is already manually disposed of here,
irq_dispose_mapping() removes the descriptor. When devres later invokes
free_irq(), it will find a NULL descriptor and return early, skipping the
kfree() for the irqaction structure.
> - }
> priv->dmatsk = dmatsk;
>
> /* Init the hw */
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260710110247.426444-1-panchuang@vivo.com?part=1
next prev parent reply other threads:[~2026-07-10 11:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 11:02 [PATCH] ata: Remove redundant dev_err() Pan Chuang
2026-07-10 11:15 ` sashiko-bot [this message]
2026-07-10 14:36 ` Hannes Reinecke
2026-07-13 7:46 ` Damien Le Moal
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=20260710111547.1C3061F01559@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=panchuang@vivo.com \
--cc=sashiko-reviews@lists.linux.dev \
/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