diff options
author | Wei WANG <wei_wang@realsil.com.cn> | 2013-01-26 19:55:16 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-01-26 20:18:07 -0500 |
commit | 2d1484f5990c094e2c706672a8d286576dd096b4 (patch) | |
tree | c818af028139077880e8f09d7164bcc8774c7e0c /drivers/mfd/rtsx_pcr.c | |
parent | ff0decd49343c7c5bd0dbeadace344d69b9f205f (diff) |
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 <wei_wang@realsil.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/rtsx_pcr.c')
-rw-r--r-- | drivers/mfd/rtsx_pcr.c | 4 |
1 files changed, 2 insertions, 2 deletions
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) | |||
786 | 786 | ||
787 | spin_unlock_irqrestore(&pcr->lock, flags); | 787 | spin_unlock_irqrestore(&pcr->lock, flags); |
788 | 788 | ||
789 | if (card_detect & SD_EXIST) | 789 | if ((card_detect & SD_EXIST) && pcr->slots[RTSX_SD_CARD].card_event) |
790 | pcr->slots[RTSX_SD_CARD].card_event( | 790 | pcr->slots[RTSX_SD_CARD].card_event( |
791 | pcr->slots[RTSX_SD_CARD].p_dev); | 791 | pcr->slots[RTSX_SD_CARD].p_dev); |
792 | if (card_detect & MS_EXIST) | 792 | if ((card_detect & MS_EXIST) && pcr->slots[RTSX_MS_CARD].card_event) |
793 | pcr->slots[RTSX_MS_CARD].card_event( | 793 | pcr->slots[RTSX_MS_CARD].card_event( |
794 | pcr->slots[RTSX_MS_CARD].p_dev); | 794 | pcr->slots[RTSX_MS_CARD].p_dev); |
795 | } | 795 | } |