Merge git://git.infradead.org/users/cbou/battery-2.6.33
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Feb 2010 22:06:15 +0000 (14:06 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Feb 2010 22:06:15 +0000 (14:06 -0800)
* git://git.infradead.org/users/cbou/battery-2.6.33:
  wm97xx_battery: Handle missing platform data gracefully

drivers/power/wm97xx_battery.c

index fa39e759a275a2a49ef7a0ceb306c4eee9c5abbf..6ea3cb5837c707963784555aabafe14c35b0b48a 100644 (file)
@@ -175,8 +175,14 @@ static int __devinit wm97xx_bat_probe(struct platform_device *dev)
                dev_err(&dev->dev, "Do not pass platform_data through "
                        "wm97xx_bat_set_pdata!\n");
                return -EINVAL;
-       } else
-               pdata = wmdata->batt_pdata;
+       }
+
+       if (!wmdata) {
+               dev_err(&dev->dev, "No platform data supplied\n");
+               return -EINVAL;
+       }
+
+       pdata = wmdata->batt_pdata;
 
        if (dev->id != -1)
                return -EINVAL;