Commit 5facb097 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Jean Delvare

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: default avatarYusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: default avatarSamu Onkalo <samu.p.onkalo@nokia.com>
Sigend-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 03a7ab08
...@@ -121,7 +121,7 @@ static int lis3lv02d_i2c_suspend(struct i2c_client *client, pm_message_t mesg) ...@@ -121,7 +121,7 @@ static int lis3lv02d_i2c_suspend(struct i2c_client *client, pm_message_t mesg)
{ {
struct lis3lv02d *lis3 = i2c_get_clientdata(client); struct lis3lv02d *lis3 = i2c_get_clientdata(client);
if (!lis3->pdata->wakeup_flags) if (!lis3->pdata || !lis3->pdata->wakeup_flags)
lis3lv02d_poweroff(lis3); lis3lv02d_poweroff(lis3);
return 0; return 0;
} }
...@@ -130,7 +130,7 @@ static int lis3lv02d_i2c_resume(struct i2c_client *client) ...@@ -130,7 +130,7 @@ static int lis3lv02d_i2c_resume(struct i2c_client *client)
{ {
struct lis3lv02d *lis3 = i2c_get_clientdata(client); struct lis3lv02d *lis3 = i2c_get_clientdata(client);
if (!lis3->pdata->wakeup_flags) if (!lis3->pdata || !lis3->pdata->wakeup_flags)
lis3lv02d_poweron(lis3); lis3lv02d_poweron(lis3);
return 0; return 0;
} }
......
...@@ -92,7 +92,7 @@ static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg) ...@@ -92,7 +92,7 @@ static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg)
{ {
struct lis3lv02d *lis3 = spi_get_drvdata(spi); struct lis3lv02d *lis3 = spi_get_drvdata(spi);
if (!lis3->pdata->wakeup_flags) if (!lis3->pdata || !lis3->pdata->wakeup_flags)
lis3lv02d_poweroff(&lis3_dev); lis3lv02d_poweroff(&lis3_dev);
return 0; return 0;
...@@ -102,7 +102,7 @@ static int lis3lv02d_spi_resume(struct spi_device *spi) ...@@ -102,7 +102,7 @@ static int lis3lv02d_spi_resume(struct spi_device *spi)
{ {
struct lis3lv02d *lis3 = spi_get_drvdata(spi); struct lis3lv02d *lis3 = spi_get_drvdata(spi);
if (!lis3->pdata->wakeup_flags) if (!lis3->pdata || !lis3->pdata->wakeup_flags)
lis3lv02d_poweron(lis3); lis3lv02d_poweron(lis3);
return 0; return 0;
......
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