]> git.sur5r.net Git - u-boot/commitdiff
usb: xhci-rcar: deregister before deactivating clock
authorMatthias Blankertz <matthias.blankertz@cetitec.com>
Tue, 22 May 2018 13:24:48 +0000 (15:24 +0200)
committerMarek Vasut <marex@denx.de>
Wed, 30 May 2018 09:59:10 +0000 (11:59 +0200)
During the execution of xhci_deregister xHCI registers are accessed. If
the clock is already deactivated when xhci_deregister is called this can
lead to undefined behavior. Change the order to deregister the device
before deactivating the clock.

Signed-off-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
drivers/usb/host/xhci-rcar.c

index a837afc483bf3c5e2fbca18f74713c32aad98ce1..f2e91ef0feb71bec72f80ebb69b3b07fecd5597d 100644 (file)
@@ -117,12 +117,15 @@ err_clk:
 
 static int xhci_rcar_deregister(struct udevice *dev)
 {
+       int ret;
        struct rcar_xhci_platdata *plat = dev_get_platdata(dev);
 
+       ret = xhci_deregister(dev);
+
        clk_disable(&plat->clk);
        clk_free(&plat->clk);
 
-       return xhci_deregister(dev);
+       return ret;
 }
 
 static int xhci_rcar_ofdata_to_platdata(struct udevice *dev)