From: Shao Mingyin The QorIQ and Seattle drivers enable platform clocks, PHYs and regulators during probe, but their port operations inherit directly from ahci_ops. This omits the platform host_stop callback, so device removal releases the resource handles without undoing their enables. Repeated unbind and bind cycles can leave enable counts unbalanced. Inherit from ahci_platform_ops so that host teardown disables the platform resources after stopping the ports. Cover both Seattle operation tables, including the variant without SGPIO support. Fixes: ecfb4598512a ("ahci: added a new driver for supporting Freescale AHCI sata") Fixes: 535dac4ab5f4 ("ata: add AMD Seattle platform driver") Signed-off-by: Shao Mingyin --- Tested on next-20261105 in an x86-64 QEMU/KVM guest with KASAN and lock checking. TEST-ONLY hooks supply RAM-backed AHCI registers and observable clock, PHY and regulator providers, retaining the original QorIQ and both Seattle operation tables and probe rollback paths. Each variant runs 12 start/devres-release cycles: unpatched, clock and PHY counts grow to 12 and all four regulators remain enabled; patched, ports stop before one platform host_stop and all counts return to zero. Per variant, 12 IRQ activation failures and 12 PHY enable failures also leave resources balanced in both kernels, without duplicate disables. Firmware discovery, full host registration and real SATA I/O are outside this test. drivers/ata/ahci_qoriq.c | 2 +- drivers/ata/ahci_seattle.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c index fc6b8cd75b..3e3ce1a02b 100644 --- a/drivers/ata/ahci_qoriq.c +++ b/drivers/ata/ahci_qoriq.c @@ -147,7 +147,7 @@ static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class, } static struct ata_port_operations ahci_qoriq_ops = { - .inherits = &ahci_ops, + .inherits = &ahci_platform_ops, .reset.hardreset = ahci_qoriq_hardreset, }; diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c index 9758fa0260..0187eb2d27 100644 --- a/drivers/ata/ahci_seattle.c +++ b/drivers/ata/ahci_seattle.c @@ -48,7 +48,7 @@ struct seattle_plat_data { }; static struct ata_port_operations ahci_port_ops = { - .inherits = &ahci_ops, + .inherits = &ahci_platform_ops, }; static const struct ata_port_info ahci_port_info = { @@ -59,7 +59,7 @@ static const struct ata_port_info ahci_port_info = { }; static struct ata_port_operations ahci_seattle_ops = { - .inherits = &ahci_ops, + .inherits = &ahci_platform_ops, .transmit_led_message = seattle_transmit_led_message, };