ANDROID: usb: xhci-plat: Fix double-free in xhci_plat_remove

Remove the duplicate usb_put_hcd(shared_hcd) to fix following
warning when unplugging the usb mouse.

 ------------[ cut here ]------------
 refcount_t: underflow; use-after-free.
 WARNING: CPU: 4 PID: 153 at lib/refcount.c:28 refcount_warn_saturate+0xf8/0x138
 Call trace:
  refcount_warn_saturate+0xf8/0x138
  usb_put_hcd+0xbc/0xc4
  xhci_plat_remove+0x124/0x1e4
  platform_remove+0x40/0x78

Bug: 290507071
Fixes: 90ab8e7f98 ("ANDROID: usb: host: add xhci hooks for USB offload")
Change-Id: Id840b6dcb69600658557c7a33e59c318f66160f5
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
This commit is contained in:
Jindong Yue 2023-07-10 10:54:40 +08:00 committed by Treehugger Robot
parent 55679fd0a8
commit 44ee9eef21

View file

@ -453,7 +453,6 @@ static int xhci_plat_remove(struct platform_device *dev)
xhci_vendor_cleanup(xhci);
usb_put_hcd(shared_hcd);
clk_disable_unprepare(clk);
clk_disable_unprepare(reg_clk);
usb_put_hcd(hcd);