summaryrefslogtreecommitdiff
path: root/drivers/hwmon/lis3lv02d_spi.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2010-09-17 17:24:10 +0200
committerJean Delvare <khali@linux-fr.org>2010-09-17 17:24:10 +0200
commit5facb097137e7509a1b73448fe20226a4fbfe8cb (patch)
tree65d6420d70466f8e4828946b5b682f0c6f272729 /drivers/hwmon/lis3lv02d_spi.c
parent03a7ab083e4d619136d6f07ce70fa9de0bc436fc (diff)
hwmon: (lis3lv02d) Prevent NULL pointer dereference
If CONFIG_PM was selected and lis3lv02d_platform_data was NULL, the kernel will be panic when halt command run. Reported-by: Yusuke Goda <yusuke.goda.sx@renesas.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Samu Onkalo <samu.p.onkalo@nokia.com> Sigend-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/lis3lv02d_spi.c')
-rw-r--r--drivers/hwmon/lis3lv02d_spi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index 82b16808a274..b9be5e3a22b3 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -92,7 +92,7 @@ static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg)
{
struct lis3lv02d *lis3 = spi_get_drvdata(spi);
- if (!lis3->pdata->wakeup_flags)
+ if (!lis3->pdata || !lis3->pdata->wakeup_flags)
lis3lv02d_poweroff(&lis3_dev);
return 0;
@@ -102,7 +102,7 @@ static int lis3lv02d_spi_resume(struct spi_device *spi)
{
struct lis3lv02d *lis3 = spi_get_drvdata(spi);
- if (!lis3->pdata->wakeup_flags)
+ if (!lis3->pdata || !lis3->pdata->wakeup_flags)
lis3lv02d_poweron(lis3);
return 0;