Re: [PATCH] mmc: sdhci-acpi: Fix free_irq() of a never requested IRQ

From: Adrian Hunter

Date: Tue Nov 24 2026 - 01:51:13 EST


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@xxxxxxxxxxxxxxxxxxxx>

WARNING: From:/Signed-off-by: email name mismatch: 'From: Xiangwu Lai <laixiangwu@xxxxxxxxxxxxxxxxxxxx>' != 'Signed-off-by: laixiangwu <laixiangwu@xxxxxxxxxxxxxxxxxxxx>'

Otherwise:

Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>

> ---
> 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)
>
>