From: Matthias Blankertz Date: Tue, 22 May 2018 16:12:39 +0200 Subject: [U-Boot] [PATCH] usb: xhci-rcar: deregister before deactivating clock Message-ID: <2b833217-bec8-eef4-ae37-ffe92c9b643a@cetitec.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de 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 ---  drivers/usb/host/xhci-rcar.c | 5 ++++-  1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c index a837afc483b..f2e91ef0feb 100644 --- a/drivers/usb/host/xhci-rcar.c +++ b/drivers/usb/host/xhci-rcar.c @@ -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) -- 2.17.0 --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. https://www.avast.com/antivirus