]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
USB: ehci: omap: fix kernel panic with rmmod
authorAjay Kumar Gupta <ajay.gupta@ti.com>
Thu, 18 Mar 2010 11:28:35 +0000 (16:58 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Apr 2010 22:18:21 +0000 (15:18 -0700)
Sets the regulator values to NULL if they are not defined. This
is required to fix the kernel panic in exit path when EHCI module
is removed on the platforms where EHCI regulator are not set.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/ehci-omap.c

index a67a0030dd57f8a44ec8c26a5478a8cdd2531065..40a8583350353883719112b33c739a382d424a17 100644 (file)
@@ -629,11 +629,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
                }
                snprintf(supply, sizeof(supply), "hsusb%d", i);
                omap->regulator[i] = regulator_get(omap->dev, supply);
-               if (IS_ERR(omap->regulator[i]))
+               if (IS_ERR(omap->regulator[i])) {
+                       omap->regulator[i] = NULL;
                        dev_dbg(&pdev->dev,
                        "failed to get ehci port%d regulator\n", i);
-               else
+               } else {
                        regulator_enable(omap->regulator[i]);
+               }
        }
 
        ret = omap_start_ehc(omap, hcd);