mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Null pointer deference in drivers/power/pm2301_charger.c
@ 2013-09-21  1:25 Valentin Ilie
  2013-09-21  3:20 ` Mike Galbraith
  0 siblings, 1 reply; 2+ messages in thread
From: Valentin Ilie @ 2013-09-21  1:25 UTC (permalink / raw)
  To: anton, dwmw2, linux-kernel

Hello,

I am trying to solve a NULL pointer deference in
drivers/power/pm2301_charger.c (and to submit a trivial patch) but I
am not sure how to do it.

Line 958 - 961
pm2 = (struct pm2xxx_charger*)i2c_get_clientdata(pm2xxx_i2c_client);
        if (!pm2) {
                dev_err(pm2->dev, "no pm2xxx_charger data supplied\n");

Line 976 - 978
pm2 = (struct pm2xxx_charger*)i2c_get_clientdata(pm2xxx_i2c_client);
        if (!pm2) {
                dev_err(pm2->dev, "no pm2xxx_charger data supplied\n");

As it can be clearly seen, pm2 is used with NULL value in dev_err. The
question is, how to fix this? Should I delete the dev_err line or can
I use printk (to avoid the need of a dev) ?

Thank you,
Valentin

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Null pointer deference in drivers/power/pm2301_charger.c
  2013-09-21  1:25 Null pointer deference in drivers/power/pm2301_charger.c Valentin Ilie
@ 2013-09-21  3:20 ` Mike Galbraith
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Galbraith @ 2013-09-21  3:20 UTC (permalink / raw)
  To: Valentin Ilie; +Cc: anton, dwmw2, linux-kernel

On Sat, 2013-09-21 at 04:25 +0300, Valentin Ilie wrote: 
> Hello,
> 
> I am trying to solve a NULL pointer deference in
> drivers/power/pm2301_charger.c (and to submit a trivial patch) but I
> am not sure how to do it.
> 
> Line 958 - 961
> pm2 = (struct pm2xxx_charger*)i2c_get_clientdata(pm2xxx_i2c_client);
>         if (!pm2) {
>                 dev_err(pm2->dev, "no pm2xxx_charger data supplied\n");
> 
> Line 976 - 978
> pm2 = (struct pm2xxx_charger*)i2c_get_clientdata(pm2xxx_i2c_client);
>         if (!pm2) {
>                 dev_err(pm2->dev, "no pm2xxx_charger data supplied\n");
> 
> As it can be clearly seen, pm2 is used with NULL value in dev_err. The
> question is, how to fix this? Should I delete the dev_err line or can
> I use printk (to avoid the need of a dev) ?

Looking below that, seems they perhaps meant &pm2xxx_i2c_client->dev.

-Mike


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-21  3:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-21  1:25 Null pointer deference in drivers/power/pm2301_charger.c Valentin Ilie
2013-09-21  3:20 ` Mike Galbraith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®