]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
mfd: rtsx: Fix oops when rtsx_pci_sdmmc is not probed
authorWei WANG <wei_wang@realsil.com.cn>
Sun, 27 Jan 2013 00:55:16 +0000 (01:55 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 27 Jan 2013 01:18:07 +0000 (02:18 +0100)
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 <wei_wang@realsil.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/rtsx_pcr.c

index 910200e10fa0e5f7f1e4d9f39d597bbe3672a029..9fc57009e22813fe257481b39352533f2fbd5d45 100644 (file)
@@ -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);
 }