Commit 2d1484f5 authored by Wei WANG's avatar Wei WANG Committed by Samuel Ortiz
Browse files

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
Check card_event pointer before referencing it can avoid kernel panic.
Signed-off-by: default avatarWei WANG <>
Signed-off-by: default avatarSamuel Ortiz <>
parent ff0decd4
...@@ -786,10 +786,10 @@ static void rtsx_pci_card_detect(struct work_struct *work) ...@@ -786,10 +786,10 @@ static void rtsx_pci_card_detect(struct work_struct *work)
spin_unlock_irqrestore(&pcr->lock, flags); 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].card_event(
pcr->slots[RTSX_SD_CARD].p_dev); 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].card_event(
pcr->slots[RTSX_MS_CARD].p_dev); pcr->slots[RTSX_MS_CARD].p_dev);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment