[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1359101359-20144-1-git-send-email-wei_wang@realsil.com.cn>
Date: Fri, 25 Jan 2013 16:09:19 +0800
From: <wei_wang@...lsil.com.cn>
To: <gregkh@...uxfoundation.org>, <devel@...uxdriverproject.org>,
<linux-kernel@...r.kernel.org>
CC: <adam.lee@...onical.com>, Wei WANG <wei_wang@...lsil.com.cn>
Subject: [PATCH] MFD:rtsx:Avoid kernel panic if rtsx_pci_sdmmc not probed
From: Wei WANG <wei_wang@...lsil.com.cn>
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@...lsil.com.cn>
---
drivers/mfd/rtsx_pcr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 910200e..9fc5700 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);
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists