From: Doug Anderson Date: Wed, 25 Feb 2015 18:11:52 +0000 (-0800) Subject: mmc: dw_mmc: Don't crash if we get an interrupt before slot has initted X-Git-Tag: firefly_0821_release~176^2~2011^2~71 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ed2540effa70097f8e74aeaa83525dea7ccfc47a;p=firefly-linux-kernel-4.4.55.git mmc: dw_mmc: Don't crash if we get an interrupt before slot has initted It's unlikely that this is really needed on any single-slot systems where we disable card detects until the end of probe, but it still seems safer to check to make sure that a slot has been initted before we try to dereference it to find the SDIO interrupt mask. Signed-off-by: Doug Anderson Tested-by: Javier Martinez Canillas Signed-off-by: Jaehoon Chung Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index a1c8f72ccc21..b46b825aaeb5 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2217,6 +2217,10 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) /* Handle SDIO Interrupts */ for (i = 0; i < host->num_slots; i++) { struct dw_mci_slot *slot = host->slot[i]; + + if (!slot) + continue; + if (pending & SDMMC_INT_SDIO(slot->sdio_id)) { mci_writel(host, RINTSTS, SDMMC_INT_SDIO(slot->sdio_id));