USB: EHCI: tegra: Fix use-after-free in .remove()
[cascardo/linux.git] / drivers / usb / host / ehci-tegra.c
index 6fdcb8a..693f792 100644 (file)
@@ -326,7 +326,7 @@ static const struct tegra_ehci_soc_config tegra20_soc_config = {
        .has_hostpc = false,
 };
 
-static struct of_device_id tegra_ehci_of_match[] = {
+static const struct of_device_id tegra_ehci_of_match[] = {
        { .compatible = "nvidia,tegra30-ehci", .data = &tegra30_soc_config },
        { .compatible = "nvidia,tegra20-ehci", .data = &tegra20_soc_config },
        { },
@@ -479,10 +479,11 @@ static int tegra_ehci_remove(struct platform_device *pdev)
 
        usb_phy_shutdown(hcd->phy);
        usb_remove_hcd(hcd);
-       usb_put_hcd(hcd);
 
        clk_disable_unprepare(tegra->clk);
 
+       usb_put_hcd(hcd);
+
        return 0;
 }