]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
USB: EHCI: tegra: Fix oops in error cleanup
authorThierry Reding <thierry.reding@gmail.com>
Fri, 14 Jun 2013 11:21:21 +0000 (13:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jun 2013 20:56:25 +0000 (13:56 -0700)
Under some circumstances it happens that the connected PHY can't be
powered up properly, in which case the cleanup path currently crashes
because it checks the tegra->transceiver field using !IS_ERR(), which
will succeed because it is in fact NULL. Dereferencing that pointer
causes an oops in tegra_ehci_probe().

This patch fixes the issue by adding an additional label into the
cleanup path to separately take down the PHY and the transceiver.

Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ehci-tegra.c

index 8dac5e41a7417c68907dd98d1559850165c9d3c9..6ee7ef79b4f86a5c802e33245592d40ec27127a5 100644 (file)
@@ -478,15 +478,15 @@ static int tegra_ehci_probe(struct platform_device *pdev)
        err = usb_add_hcd(hcd, irq, IRQF_SHARED);
        if (err) {
                dev_err(&pdev->dev, "Failed to add USB HCD\n");
-               goto cleanup_phy;
+               goto cleanup_transceiver;
        }
 
        return err;
 
-cleanup_phy:
+cleanup_transceiver:
        if (!IS_ERR(tegra->transceiver))
                otg_set_host(tegra->transceiver->otg, NULL);
-
+cleanup_phy:
        usb_phy_shutdown(hcd->phy);
 cleanup_clk_en:
        clk_disable_unprepare(tegra->clk);