linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] power/ab8500_charger: harden platform data check
@ 2012-04-13  8:15 Linus Walleij
  2012-04-13  8:42 ` Arun MURTHY
  2012-04-28 12:59 ` Linus Walleij
  0 siblings, 2 replies; 14+ messages in thread
From: Linus Walleij @ 2012-04-13  8:15 UTC (permalink / raw)
  To: Anton Vorontsov, linux-kernel
  Cc: Karl Komierowski, Linus Walleij, Arun Murthy

From: Linus Walleij <linus.walleij@linaro.org>

If no platform data at all is supplied the driver crashes,
extend the checks to be more careful so we can compile in the
driver and boot also without platform data present.

Cc: Arun Murthy <arun.murthy@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/power/ab8500_charger.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index e2b4acc..79dc584 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -2551,13 +2551,12 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev)
 
 	/* get charger specific platform data */
 	plat_data = pdev->dev.platform_data;
-	di->pdata = plat_data->charger;
-
-	if (!di->pdata) {
+	if (!plat_data || !plat_data->charger) {
 		dev_err(di->dev, "no charger platform data supplied\n");
 		ret = -EINVAL;
 		goto free_device_info;
 	}
+	di->pdata = plat_data->charger;
 
 	/* get battery specific platform data */
 	di->bat = plat_data->battery;
-- 
1.7.9.2


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

end of thread, other threads:[~2012-05-23 19:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-13  8:15 [PATCH 1/3] power/ab8500_charger: harden platform data check Linus Walleij
2012-04-13  8:42 ` Arun MURTHY
2012-05-05 12:06   ` Anton Vorontsov
2012-04-28 12:59 ` Linus Walleij
2012-04-28 16:38   ` Lee Jones
2012-05-05 12:08     ` Anton Vorontsov
     [not found]       ` <CAF2Aj3hy3KOsH3aiZ0UpuERSwOoqFdYQ4su-hEVcU-qp8r5d9A@mail.gmail.com>
2012-05-05 21:55         ` Anton Vorontsov
2012-05-06  7:25           ` Lee Jones
2012-05-22 11:34       ` Lee Jones
2012-05-22 11:56         ` Anton Vorontsov
2012-05-22 12:03           ` Lee Jones
2012-05-22 13:22             ` Anton Vorontsov
2012-05-23 19:00           ` Linus Walleij
2012-05-02 11:31   ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).