Merge branch 'v3.5-rc7-fixes' of git://github.com/lunn/linux into fixes
[deliverable/linux.git] / drivers / power / ab8500_charger.c
index e2b4accbec8815782ad1bf659b90e40196d31b63..d2303d0b7c755669f7ab48b968e062474241997b 100644 (file)
@@ -2534,10 +2534,15 @@ static int __devexit ab8500_charger_remove(struct platform_device *pdev)
 static int __devinit ab8500_charger_probe(struct platform_device *pdev)
 {
        int irq, i, charger_status, ret = 0;
-       struct abx500_bm_plat_data *plat_data;
+       struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data;
+       struct ab8500_charger *di;
 
-       struct ab8500_charger *di =
-               kzalloc(sizeof(struct ab8500_charger), GFP_KERNEL);
+       if (!plat_data) {
+               dev_err(&pdev->dev, "No platform data\n");
+               return -EINVAL;
+       }
+
+       di = kzalloc(sizeof(*di), GFP_KERNEL);
        if (!di)
                return -ENOMEM;
 
@@ -2550,9 +2555,7 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev)
        spin_lock_init(&di->usb_state.usb_lock);
 
        /* get charger specific platform data */
-       plat_data = pdev->dev.platform_data;
        di->pdata = plat_data->charger;
-
        if (!di->pdata) {
                dev_err(di->dev, "no charger platform data supplied\n");
                ret = -EINVAL;
This page took 0.024213 seconds and 5 git commands to generate.