From: Wei WANG Date: Sun, 27 Jan 2013 00:55:16 +0000 (+0100) Subject: mfd: rtsx: Fix oops when rtsx_pci_sdmmc is not probed X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2d1484f5990c094e2c706672a8d286576dd096b4;p=linux-beck.git mfd: rtsx: Fix oops when rtsx_pci_sdmmc is not probed If rtsx_pci_sdmmc is not probed, function pointer pcr->slots[].card_event will point to NULL, and thus rtsx_pci_card_detect will reference a NULL pointer. Check card_event pointer before referencing it can avoid kernel panic. Signed-off-by: Wei WANG Signed-off-by: Samuel Ortiz --- diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index 910200e10fa0..9fc57009e228 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c @@ -786,10 +786,10 @@ static void rtsx_pci_card_detect(struct work_struct *work) spin_unlock_irqrestore(&pcr->lock, flags); - if (card_detect & SD_EXIST) + if ((card_detect & SD_EXIST) && pcr->slots[RTSX_SD_CARD].card_event) pcr->slots[RTSX_SD_CARD].card_event( pcr->slots[RTSX_SD_CARD].p_dev); - if (card_detect & MS_EXIST) + if ((card_detect & MS_EXIST) && pcr->slots[RTSX_MS_CARD].card_event) pcr->slots[RTSX_MS_CARD].card_event( pcr->slots[RTSX_MS_CARD].p_dev); }