From: Wei Yongjun <yongjun_...@trendmicro.com.cn>

The dereference should be moved below the NULL test.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_...@trendmicro.com.cn>
---
 drivers/usb/host/ehci-tegra.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 6223d17..e40fcb0 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -776,9 +776,13 @@ fail_clk:
 static int tegra_ehci_remove(struct platform_device *pdev)
 {
        struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
-       struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci);
+       struct usb_hcd *hcd;
+
+       if (tegra == NULL)
+               return -EINVAL;
 
-       if (tegra == NULL || hcd == NULL)
+       hcd = ehci_to_hcd(tegra->ehci);
+       if (hcd == NULL)
                return -EINVAL;
 
        pm_runtime_get_sync(&pdev->dev);

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to