diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2010-09-17 11:24:10 -0400 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2010-09-17 11:24:10 -0400 |
commit | 5facb097137e7509a1b73448fe20226a4fbfe8cb (patch) | |
tree | 65d6420d70466f8e4828946b5b682f0c6f272729 /drivers/hwmon | |
parent | 03a7ab083e4d619136d6f07ce70fa9de0bc436fc (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')
-rw-r--r-- | drivers/hwmon/lis3lv02d_i2c.c | 4 | ||||
-rw-r--r-- | drivers/hwmon/lis3lv02d_spi.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/hwmon/lis3lv02d_i2c.c b/drivers/hwmon/lis3lv02d_i2c.c index dc1f5402c1d7..8e5933b72d19 100644 --- a/drivers/hwmon/lis3lv02d_i2c.c +++ b/drivers/hwmon/lis3lv02d_i2c.c | |||
@@ -121,7 +121,7 @@ static int lis3lv02d_i2c_suspend(struct i2c_client *client, pm_message_t mesg) | |||
121 | { | 121 | { |
122 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 122 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
123 | 123 | ||
124 | if (!lis3->pdata->wakeup_flags) | 124 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
125 | lis3lv02d_poweroff(lis3); | 125 | lis3lv02d_poweroff(lis3); |
126 | return 0; | 126 | return 0; |
127 | } | 127 | } |
@@ -130,7 +130,7 @@ static int lis3lv02d_i2c_resume(struct i2c_client *client) | |||
130 | { | 130 | { |
131 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 131 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
132 | 132 | ||
133 | if (!lis3->pdata->wakeup_flags) | 133 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
134 | lis3lv02d_poweron(lis3); | 134 | lis3lv02d_poweron(lis3); |
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
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) | |||
92 | { | 92 | { |
93 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); | 93 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); |
94 | 94 | ||
95 | if (!lis3->pdata->wakeup_flags) | 95 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
96 | lis3lv02d_poweroff(&lis3_dev); | 96 | lis3lv02d_poweroff(&lis3_dev); |
97 | 97 | ||
98 | return 0; | 98 | return 0; |
@@ -102,7 +102,7 @@ static int lis3lv02d_spi_resume(struct spi_device *spi) | |||
102 | { | 102 | { |
103 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); | 103 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); |
104 | 104 | ||
105 | if (!lis3->pdata->wakeup_flags) | 105 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
106 | lis3lv02d_poweron(lis3); | 106 | lis3lv02d_poweron(lis3); |
107 | 107 | ||
108 | return 0; | 108 | return 0; |