summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbui duc phuc <phucduc.bui@gmail.com>2026-08-13 12:34:02 +0700
committerUlf Hansson <ulfh@kernel.org>2026-09-08 17:26:32 +0200
commitb57cc4ec84a887e452ea2c7872a4eb13f03608e6 (patch)
tree4dce0910a28358e7e457d453e48039d6830ea8cb
parent534e7ff869b7b6d16ba2de90507da1bc86f82f0f (diff)
downloadlinux-next-b57cc4ec84a887e452ea2c7872a4eb13f03608e6.tar.gz
linux-next-b57cc4ec84a887e452ea2c7872a4eb13f03608e6.zip
mmc: meson-gx: Handle errors from optional IRQ lookup
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no optional IRQ is available. Other errors, such as -EPROBE_DEFER and -EINVAL, should be propagated so that the caller can handle them appropriately. However, the driver currently stores the return value directly in cd_irq and continues probing. Propagate negative errors other than -ENXIO, and only assign the IRQ to cd_irq when a valid IRQ number is returned. Signed-off-by: bui duc phuc <phucduc.bui@gmail.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
-rw-r--r--drivers/mmc/host/meson-gx-mmc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 694bb443d5f3..d2903e3dfd6f 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1141,7 +1141,8 @@ static int meson_mmc_probe(struct platform_device *pdev)
struct meson_host *host;
struct mmc_host *mmc;
struct clk *core_clk;
- int cd_irq, ret;
+ int cd_irq = -ENXIO;
+ int ret;
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(struct meson_host));
if (!mmc)
@@ -1185,7 +1186,11 @@ static int meson_mmc_probe(struct platform_device *pdev)
if (host->irq < 0)
return host->irq;
- cd_irq = platform_get_irq_optional(pdev, 1);
+ ret = platform_get_irq_optional(pdev, 1);
+ if (ret < 0 && ret != -ENXIO)
+ return ret;
+ if (ret > 0)
+ cd_irq = ret;
mmc_gpio_set_cd_irq(mmc, cd_irq);
host->pinctrl = devm_pinctrl_get(&pdev->dev);