Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: rockchip-inno-usb2: Return zero after otg sync

The otg sync state patch reuses the ret variable, but fails to set it to
zero after use. This leads to a situation when the otg port is in
peripheral mode where the otg phy aborts halfway through setup. It also
fails to account for a failure to register the extcon notifier. Fix this
by using our own variable and skipping otg sync in case of failure.

Fixes: 8dc60f8da22f ("phy: rockchip-inno-usb2: Sync initial otg state")
Reported-by: Markus Reichl <m.reichl@fivetechno.de>
Reported-by: Michael Riesch <michael.riesch@wolfvision.net>
Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
Tested-by: Markus Reichl <m.reichl@fivetechno.de>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20220902184543.1234835-1-pgwipeout@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Peter Geis and committed by
Vinod Koul
f340ed86 766ab0de

+6 -4
+6 -4
drivers/phy/rockchip/phy-rockchip-inno-usb2.c
··· 1124 1124 struct rockchip_usb2phy_port *rport, 1125 1125 struct device_node *child_np) 1126 1126 { 1127 - int ret; 1127 + int ret, id; 1128 1128 1129 1129 rport->port_id = USB2PHY_PORT_OTG; 1130 1130 rport->port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG]; ··· 1162 1162 1163 1163 ret = devm_extcon_register_notifier(rphy->dev, rphy->edev, 1164 1164 EXTCON_USB_HOST, &rport->event_nb); 1165 - if (ret) 1165 + if (ret) { 1166 1166 dev_err(rphy->dev, "register USB HOST notifier failed\n"); 1167 + goto out; 1168 + } 1167 1169 1168 1170 if (!of_property_read_bool(rphy->dev->of_node, "extcon")) { 1169 1171 /* do initial sync of usb state */ 1170 - ret = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); 1171 - extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret); 1172 + id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); 1173 + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id); 1172 1174 } 1173 1175 } 1174 1176