Skip to content

Commit

Permalink
usb: ci: host: fix unbalanced regulator_disable() call [STREAMEIGHT-5…
Browse files Browse the repository at this point in the history
…763-comment]

When over current is detected, the regulator is disabled. When device is
rebooted it would cause the following stacktrace:

------------[ cut here ]------------
unbalanced disables for usb1_drvvbus
WARNING: CPU: 1 PID: 496 at drivers/regulator/core.c:2759 _regulator_disable+0xd4/0x198
Modules linked in:
CPU: 1 PID: 496 Comm: reboot Tainted: G        W         5.10.72-00112-g9522750b3530 torvalds#29
Hardware name: StreamUnlimited Stream195x module (i.MX8MM) (DT)
pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--)
pc : _regulator_disable+0xd4/0x198
lr : _regulator_disable+0xd4/0x198
sp : ffff800012feb8d0
x29: ffff800012feb8d0 x28: ffff000004663900
x27: 0000000000000000 x26: ffff800010ddb360
x25: 0000000000000008 x24: ffff000004328c10
x23: ffff000005030080 x22: ffff000004fb9810
x21: ffff000004cde800 x20: ffff000004fb6c00
x19: ffff000004663900 x18: 0000000000000010
x17: 0000000000000000 x16: 0000000000000000
x15: ffff000004663d70 x14: 0000000000000363
x13: ffff000004663d70 x12: 00000000ffffffea
x11: ffff800011121510 x10: ffff8000111094d0
x9 : ffff800011109528 x8 : 0000000000017fe8
x7 : c0000000ffffefff x6 : 0000000000000001
x5 : 0000000000000000 x4 : 0000000000000000
x3 : 00000000ffffffff x2 : ffff8000110b14a0
x1 : abfe2db304d22000 x0 : 0000000000000000
Call trace:
 _regulator_disable+0xd4/0x198
 regulator_disable+0x40/0x80
 ehci_ci_portpower+0x98/0x118
 ehci_port_power+0x58/0xb0
 ehci_silence_controller+0x68/0xf0
 ehci_stop+0x48/0xf0
 usb_remove_hcd+0x134/0x2f0
 host_stop+0x38/0xa0
 ci_hdrc_host_destroy+0x20/0x30
 ci_hdrc_remove+0x64/0x140
 platform_drv_remove+0x2c/0x50
 device_release_driver_internal+0x114/0x1f0
 device_release_driver+0x18/0x28
 bus_remove_device+0x128/0x138
 device_del+0x16c/0x3d8
 platform_device_del.part.0+0x1c/0x88
 platform_device_unregister+0x24/0x40
 ci_hdrc_remove_device+0x18/0x38
 ci_hdrc_imx_remove+0x2c/0x120
 ci_hdrc_imx_shutdown+0x10/0x20
 platform_drv_shutdown+0x20/0x30
 device_shutdown+0x158/0x360
 kernel_restart_prepare+0x38/0x48
 kernel_restart+0x18/0x68
 __do_sys_reboot+0x104/0x210
 __arm64_sys_reboot+0x24/0x30
 el0_svc_common.constprop.0+0x78/0x1c8
 do_el0_svc+0x24/0x90
 el0_svc+0x14/0x20
 el0_sync_handler+0xb0/0xb8
 el0_sync+0x180/0x1c0
---[ end trace 158c6def3b377a9f ]---

Fixes: 8fb687e ("usb/chipidea: Poll for overcurrent condition")

Signed-off-by: Peter Suti <[email protected]>
  • Loading branch information
psi-sue authored and dasty committed Jan 13, 2025
1 parent a3e58b7 commit 00e16fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/chipidea/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
}
if (enable)
ret = regulator_enable(priv->reg_vbus);
else
else if (!ci->vbus_overcurrent)
ret = regulator_disable(priv->reg_vbus);
if (ret) {
dev_err(dev,
Expand Down

0 comments on commit 00e16fc

Please sign in to comment.