From: Niklas Cassel <cassel@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: Nikolay Borisov <nik.borisov@suse.com>,
linux-ide@vger.kernel.org, dlemoal@kernel.org,
Rosen Penev <rosenp@gmail.com>
Subject: Re: [PATCH v2] ata: sata_dwc_460ex: Don't enable interrupt if libATA core registration fails
Date: Wed, 9 Sep 2026 18:13:02 +0200 [thread overview]
Message-ID: <aqGFjsuIMRIy5xfv@ryzen> (raw)
In-Reply-To: <20260909113821.A72011F00A3A@smtp.kernel.org>
On Wed, Sep 09, 2026 at 11:38:21AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
>
> New issues:
> - [High] Inverted teardown sequence for the PHY on probe error path, calling phy_power_off() after phy_exit().
Looking at ahci_platform.c:ahci_probe()
ahci_probe() calls
ahci_platform_enable_resources() which calls ahci_platform_enable_phys()
which calls
phy_init() and phy_power_on().
ahci_probe() later calls
ahci_platform_init_host() which calls ahci_host_activate()
if ahci_platform_init_host() fails, ahci_probe() calls
calls ahci_platform_disable_resources(), which calls
phy_power_off() and and phy_exit().
So the problem is that sata_dwc_460ex calls phy_power_on() in
->port_stop.
(And that it calls phy_power_on() in ->port_start()).
These calls should just be in sata_dwc_probe().
I don't see any other driver doing phy_power_on()/phy_power_off()
in ->port_start()/->port_stop().
It seems very wrong... Because sata_dwc_460ex will call phy_power_off()
for the same phy, when having multiple ports. phy_power_off() should
not be called multiple times on the same phy.
This driver is quite broken.
You could just send a patch that does:
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 8e3fc713891a..0690e31719d2 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -1185,11 +1185,12 @@ static int sata_dwc_probe(struct platform_device *ofdev)
* error_handler() to execute a dummy Softreset EH session
*/
err = ata_host_activate(host, irq, sata_dwc_isr, 0, &sata_dwc_sht);
- if (err)
+ if (err) {
dev_err(dev, "failed to activate host");
-
- /* Enable SATA Interrupts */
- sata_dwc_enable_interrupts(hsdev);
+ } else {
+ /* Enable SATA Interrupts */
+ sata_dwc_enable_interrupts(hsdev);
+ }
return 0;
error_out:
Or if you want to clean this up, create a patch that moves
the phy_power_on() from ->port_start() to sata_dwc_probe()
and phy_power_off() from ->port_stop() to sata_dwc_probe().
Then you will be able to call goto error_out; on ata_host_activate() failure.
Kind regards,
Niklas
prev parent reply other threads:[~2026-09-09 16:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 11:24 [PATCH v2] ata: sata_dwc_460ex: Don't enable interrupt if libATA core registration fails Nikolay Borisov
2026-09-09 11:38 ` sashiko-bot
2026-09-09 16:13 ` Niklas Cassel [this message]
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=aqGFjsuIMRIy5xfv@ryzen \
--to=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=nik.borisov@suse.com \
--cc=rosenp@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.