power/gpio-charger: check for kzalloc() failure
PATCH 1/1 power/gpio-charger: check for kzalloc() failure
Return -ENOMEM if kzalloc() fails.
drivers/power/gpio-charger.c +2 -0
@@ -87,6 +87,8 @@ static int __devinit gpio_charger_probe(struct platform_device *pdev) } gpio_charger =kzalloc (sizeof (*gpio_charger),GFP_KERNEL ); +if (!gpio_charger) +return -ENOMEM ; charger = &gpio_charger->charger;
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 9 lines · Dan Carpenter
Return
-ENOMEMifkzalloc()fails.Signed-off-by Dan Carpenter <[email protected]>drivers/power/gpio-charger.c +0
-0
drivers/power/gpio-charger.c static int __devinit gpio_charger_probe(struct platform_device *pdev) · line 94
Quoted 8 lines
drivers/power/gpio-charger.c +2
-0@@ -87,6 +87,8 @@ static int __devinit gpio_charger_probe(struct platform_device *pdev) } gpio_charger =kzalloc (sizeof (*gpio_charger),GFP_KERNEL ); +if (!gpio_charger) +return -ENOMEM ; charger = &gpio_charger->charger;
Hi
This is now the 4th patch or so fixing this issue. I send the first one[1], together with some other fixes[2][3], a month ago.
Anton could you please pick them up?
Thanks
- - Lars
[1] http://lkml.indiana.edu/hypermail/linux/kernel/1011.2/02029.html
[2] http://lkml.indiana.edu/hypermail/linux/kernel/1011.2/02028.html
[3] http://lkml.indiana.edu/hypermail/linux/kernel/1011.2/02030.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk0PtuYACgkQBX4mSR26RiOCRQCfdKUdpAjX2GxAJuGVekZDiyjx j3IAnRCS562ud3Ali/B5V1gWNeBHcxNj
=M4Vg
-----END PGP SIGNATURE-----
Quoted 1 line · Lars-Peter Clausen
This is now the 4th patch or so fixing this issue.
Haha. No one can resist the easy one liners. If I had had to kfree() a single variable before returning then you can know for a fact I'd be too lazy to fix it. :P
regards,
dan carpenter