Skip to content

Commit

Permalink
usb: otg: twl4030-usb: Fix unbalanced regulator disables at module re…
Browse files Browse the repository at this point in the history
…moval

Function twl4030_usb_remove can cause unbalanced regulator disables in
twl4030_phy_power if the cable is not connected. Regulator enable/disable
calls are in balance only if the twl4030_phy_resume was called prior the
twl4030_usb_remove, that is, the cable was connected.

Fix this by checking the 'asleep' variable in twl4030_usb_remove since that
variable is used to check state in other functions.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jarkko Nikula authored and Greg Kroah-Hartman committed Dec 1, 2010
1 parent 02303f7 commit c3d6450
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/otg/twl4030-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev)
/* disable complete OTG block */
twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB);

twl4030_phy_power(twl, 0);
if (!twl->asleep)
twl4030_phy_power(twl, 0);
regulator_put(twl->usb1v5);
regulator_put(twl->usb1v8);
regulator_put(twl->usb3v1);
Expand Down

0 comments on commit c3d6450

Please sign in to comment.