Skip to content

Commit

Permalink
usb: phy: gpio-vbus: don't ignore regulator APIs return value
Browse files Browse the repository at this point in the history
Due to recent changes to regulator API, all
users which don't check regulator_{en,dis}able()'s
return value will generate compile warnings.

Add such checks to gpio-vbus.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Felipe Balbi committed Mar 20, 2013
1 parent b64a159 commit e8d891f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/usb/phy/phy-gpio-vbus-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static void set_vbus_draw(struct gpio_vbus_data *gpio_vbus, unsigned mA)
{
struct regulator *vbus_draw = gpio_vbus->vbus_draw;
int enabled;
int ret;

if (!vbus_draw)
return;
Expand All @@ -69,12 +70,16 @@ static void set_vbus_draw(struct gpio_vbus_data *gpio_vbus, unsigned mA)
if (mA) {
regulator_set_current_limit(vbus_draw, 0, 1000 * mA);
if (!enabled) {
regulator_enable(vbus_draw);
ret = regulator_enable(vbus_draw);
if (ret < 0)
return;
gpio_vbus->vbus_draw_enabled = 1;
}
} else {
if (enabled) {
regulator_disable(vbus_draw);
ret = regulator_disable(vbus_draw);
if (ret < 0)
return;
gpio_vbus->vbus_draw_enabled = 0;
}
}
Expand Down

0 comments on commit e8d891f

Please sign in to comment.