gpio-charger: Check result of kzalloc
[linux-2.6.git] / drivers / power / gpio-charger.c
index fccbe99..8458caf 100644 (file)
@@ -87,6 +87,10 @@ static int __devinit gpio_charger_probe(struct platform_device *pdev)
        }
 
        gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL);
+       if (!gpio_charger) {
+               dev_err(&pdev->dev, "Failed to alloc driver structure\n");
+               return -ENOMEM;
+       }
 
        charger = &gpio_charger->charger;