[PATCH] usb: phy: gpio-vbus: don't ignore regulator APIs return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---

it would've been better to actually return regulator
API's to upper layers, but since set_vbus_draw()
returns nothing...

 drivers/usb/phy/phy-gpio-vbus-usb.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
index a7d4ac5..4c76074 100644
--- a/drivers/usb/phy/phy-gpio-vbus-usb.c
+++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
@@ -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;
@@ -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;
 		}
 	}
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux