[PATCH 1/2] mmc: slot-gpio: check cd_gpio before setting up cd_gpio_isr
From: Jisheng Zhang
Date: Tue Apr 11 2017 - 06:28:12 EST
slot-gpio knows more information than its user, such as whether there
is cd gpio_desc or not. While one of its user -- the common sdhci
driver doesn't know it. To prepare for next patch which will setup
sdhci's own isr for card-detect interrupts, we add the check before
setting up cd_gpio_isr.
Signed-off-by: Jisheng Zhang <jszhang@xxxxxxxxxxx>
---
drivers/mmc/core/slot-gpio.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index a8450a8701e4..42b260593955 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -162,6 +162,9 @@ void mmc_gpio_set_cd_isr(struct mmc_host *host,
{
struct mmc_gpio *ctx = host->slot.handler_priv;
+ if (!ctx->cd_gpio)
+ return;
+
WARN_ON(ctx->cd_gpio_isr);
ctx->cd_gpio_isr = isr;
}
--
2.11.0