Skip to content

Commit

Permalink
hwmon: (lis3lv02d) Prevent NULL pointer dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kuninori Morimoto authored and Jean Delvare committed Sep 17, 2010
1 parent 03a7ab0 commit 5facb09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/hwmon/lis3lv02d_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static int lis3lv02d_i2c_suspend(struct i2c_client *client, pm_message_t mesg)
{
struct lis3lv02d *lis3 = i2c_get_clientdata(client);

if (!lis3->pdata->wakeup_flags)
if (!lis3->pdata || !lis3->pdata->wakeup_flags)
lis3lv02d_poweroff(lis3);
return 0;
}
Expand All @@ -130,7 +130,7 @@ static int lis3lv02d_i2c_resume(struct i2c_client *client)
{
struct lis3lv02d *lis3 = i2c_get_clientdata(client);

if (!lis3->pdata->wakeup_flags)
if (!lis3->pdata || !lis3->pdata->wakeup_flags)
lis3lv02d_poweron(lis3);
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/hwmon/lis3lv02d_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 5facb09

Please sign in to comment.