Avoid null pointer access on early call to pcf50633_mbc_get_status
authorNelson Castillo <arhuaco@freaks-unidos.net>
Fri, 15 May 2009 04:46:41 +0000 (23:46 -0500)
committerNelson Castillo <arhuaco@freaks-unidos.net>
Fri, 15 May 2009 04:46:41 +0000 (23:46 -0500)
Avoid a kernel panic during an early call
to the pcf50633_mbc_get_status function.

drivers/power/pcf50633-charger.c

index 8772604..1bdb990 100644 (file)
@@ -114,6 +114,9 @@ int pcf50633_mbc_get_status(struct pcf50633 *pcf)
        struct pcf50633_mbc *mbc  = platform_get_drvdata(pcf->mbc_pdev);
        int status = 0;
 
+       if (!mbc)
+               return 0;
+
        if (mbc->usb_online)
                status |= PCF50633_MBC_USB_ONLINE;
        if (mbc->usb_active)