mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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; 4+ 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] 4+ messages in thread

end of thread, other threads:[~2026-11-24  7:32 UTC | newest]

Thread overview: 4+ 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
2026-11-24  7:32   ` Xiangwu Lai

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®