Skip to contentSkip to conversation

usb: xhci-rcar: deregister before deactivating clock

PATCH New Matthias Blankertz 2 participants 2 messages May 22, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: xhci-rcar: deregister before deactivating clock

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.

---
 drivers/usb/host/xhci-rcar.c | 5 ++++-

 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-rcar.c +0 -0
index a837afc483b..f2e91ef0feb 100644
@@ -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)

Signature · 6 lines
2.17.0


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus
Applied
#1 lore raw

PATCH 1/1 usb: xhci-rcar: deregister before deactivating clock

Quoted 6 lines · Matthias Blankertz

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.

Applied, thanks

Signature · 2 lines
Best regards,
Marek Vasut