Skip to content

Commit 46adcf3

Browse files
Fabio Estevamgregkh
authored andcommitted
usb: chipidea: host: Only disable the vbus regulator if it is not NULL
Commit 40ed51a (usb: chipidea: host: add vbus regulator control) introduced a smatch complaint because regulator_disable() is called without checking whether ci->platdata->reg_vbus is not NULL. Fix this by adding the check. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b8c8fc6 commit 46adcf3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/usb/chipidea/host.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ static int host_start(struct ci_hdrc *ci)
8888
return ret;
8989

9090
disable_reg:
91-
regulator_disable(ci->platdata->reg_vbus);
91+
if (ci->platdata->reg_vbus)
92+
regulator_disable(ci->platdata->reg_vbus);
9293

9394
put_hcd:
9495
usb_put_hcd(hcd);

0 commit comments

Comments
 (0)