* [PATCH] mmc: sdhci-acpi: Fix free_irq() of a never requested IRQ
@ 2026-11-10 7:00 Xiangwu Lai
2026-11-24 4:42 ` Xiangwu Lai
2026-11-24 6:16 ` Adrian Hunter
0 siblings, 2 replies; 3+ messages in thread
From: Xiangwu Lai @ 2026-11-10 7:00 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson; +Cc: linux-mmc, linux-kernel, Xiangwu Lai
qcom_probe_slot() stores the IRQ number from platform_get_irq() in
*irq and requests it afterwards. When request_threaded_irq() fails,
sdhci_acpi_probe() already jumps to the error path that calls
qcom_free_slot(), but *irq still holds the positive IRQ number, so
the (*irq < 0) guard in qcom_free_slot() does not catch it and
free_irq() is called for an IRQ that was never requested, resulting
in a "Trying to free already-free IRQ" warning.
Reset *irq to the -EINVAL sentinel when the request fails, so
qcom_free_slot() skips the free_irq() as intended.
Fixes: 96ccb858093d ("sdhci: acpi: add qcom sdhci host reset quirk fix")
Signed-off-by: laixiangwu <laixiangwu@cmss.chinamobile.com>
---
drivers/mmc/host/sdhci-acpi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 84c705460..85705d2eb 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -412,6 +412,7 @@ static int qcom_probe_slot(struct platform_device *pdev, struct acpi_device *ade
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
struct sdhci_host *host = c->host;
int *irq = sdhci_acpi_priv(c);
+ int ret;
*irq = -EINVAL;
@@ -422,9 +423,13 @@ static int qcom_probe_slot(struct platform_device *pdev, struct acpi_device *ade
if (*irq < 0)
return 0;
- return request_threaded_irq(*irq, NULL, sdhci_acpi_qcom_handler,
+ ret = request_threaded_irq(*irq, NULL, sdhci_acpi_qcom_handler,
IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
"sdhci_qcom", host);
+ if (ret)
+ *irq = -EINVAL;
+
+ return ret;
}
static int qcom_free_slot(struct platform_device *pdev)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: sdhci-acpi: Fix free_irq() of a never requested IRQ
2026-11-10 7:00 [PATCH] mmc: sdhci-acpi: Fix free_irq() of a never requested IRQ Xiangwu Lai
@ 2026-11-24 4:42 ` Xiangwu Lai
2026-11-24 6:16 ` Adrian Hunter
1 sibling, 0 replies; 3+ messages in thread
From: Xiangwu Lai @ 2026-11-24 4:42 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson; +Cc: Xiangwu Lai, linux-mmc, linux-kernel
Hello Adrian, Ulf,
A gentle ping on this patch, sent two weeks ago on Nov 10:
mmc: sdhci-acpi: Fix free_irq() of a never requested IRQ
https://lore.kernel.org/all/20261110070032.1387-1-laixiangwu@cmss.chinamobile.com/
The patch fixes the Intel BYT/HSD/AMD error path: when
sdhci_add_host() fails, sdhci_acpi_remove() still runs
free_irq(slot->host->irq, host) on an IRQ that was never requested by
that probe attempt, triggering the "Trying to free already-free IRQ"
WARNING in the IRQ core. The fix keeps *irq at 0 until the request has
actually succeeded, mirroring what the sdhci-pltfm probe order already
does.
Please let me know if anything else is needed.
Thanks,
Xiangwu Lai
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: sdhci-acpi: Fix free_irq() of a never requested IRQ
2026-11-10 7:00 [PATCH] mmc: sdhci-acpi: Fix free_irq() of a never requested IRQ Xiangwu Lai
2026-11-24 4:42 ` Xiangwu Lai
@ 2026-11-24 6:16 ` Adrian Hunter
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2026-11-24 6:16 UTC (permalink / raw)
To: Xiangwu Lai, Ulf Hansson; +Cc: linux-mmc, linux-kernel
On 10/11/2026 09:00, Xiangwu Lai wrote:
> qcom_probe_slot() stores the IRQ number from platform_get_irq() in
> *irq and requests it afterwards. When request_threaded_irq() fails,
> sdhci_acpi_probe() already jumps to the error path that calls
> qcom_free_slot(), but *irq still holds the positive IRQ number, so
> the (*irq < 0) guard in qcom_free_slot() does not catch it and
> free_irq() is called for an IRQ that was never requested, resulting
> in a "Trying to free already-free IRQ" warning.
>
> Reset *irq to the -EINVAL sentinel when the request fails, so
> qcom_free_slot() skips the free_irq() as intended.
>
> Fixes: 96ccb858093d ("sdhci: acpi: add qcom sdhci host reset quirk fix")
> Signed-off-by: laixiangwu <laixiangwu@cmss.chinamobile.com>
WARNING: From:/Signed-off-by: email name mismatch: 'From: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>' != 'Signed-off-by: laixiangwu <laixiangwu@cmss.chinamobile.com>'
Otherwise:
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-acpi.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index 84c705460..85705d2eb 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -412,6 +412,7 @@ static int qcom_probe_slot(struct platform_device *pdev, struct acpi_device *ade
> struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
> struct sdhci_host *host = c->host;
> int *irq = sdhci_acpi_priv(c);
> + int ret;
>
> *irq = -EINVAL;
>
> @@ -422,9 +423,13 @@ static int qcom_probe_slot(struct platform_device *pdev, struct acpi_device *ade
> if (*irq < 0)
> return 0;
>
> - return request_threaded_irq(*irq, NULL, sdhci_acpi_qcom_handler,
> + ret = request_threaded_irq(*irq, NULL, sdhci_acpi_qcom_handler,
> IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
> "sdhci_qcom", host);
> + if (ret)
> + *irq = -EINVAL;
> +
> + return ret;
> }
>
> static int qcom_free_slot(struct platform_device *pdev)
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-24 6:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 7:00 [PATCH] mmc: sdhci-acpi: Fix free_irq() of a never requested IRQ Xiangwu Lai
2026-11-24 4:42 ` Xiangwu Lai
2026-11-24 6:16 ` Adrian Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®