diff mbox

Latest build results - errors/warnings - lots of them

Message ID 20130506124011.7e4c2806@notabene.brown (mailing list archive)
State New, archived
Headers show

Commit Message

NeilBrown May 6, 2013, 2:40 a.m. UTC
On Thu, 2 May 2013 08:38:34 -0700 Tony Lindgren <tony@atomide.com> wrote:

> > drivers/power/twl4030_charger.c: In function 'twl4030_charger_enable_usb':
> > drivers/power/twl4030_charger.c:192:20: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result
> 
> Neil, care to provide a fix for this? It's from your commit ab37813
> (twl4030_charger: Allow charger to control the regulator that feeds it).
> 
>
This the sort of thing that might be appropriate?

NeilBrown


From: NeilBrown <neilb@suse.de>
Date: Mon, 6 May 2013 12:35:59 +1000
Subject: [PATCH] twl4030_charger: don't ignore regulator_enable()

regulator_enable() doesn't like being ignored.  If it does fail there
is nothing we can do except not set usb_enabled (which is necessary
else a subsequent regulator_disable() will be unbalanced).

We cannot usefully return an error here as errors from
twl4030_charger_enable_usb() are ignored.

Signed-off-by: NeilBrown <neilb@suse.de>

Comments

Tony Lindgren May 8, 2013, 10:17 p.m. UTC | #1
* NeilBrown <neilb@suse.de> [130505 19:45]:
> On Thu, 2 May 2013 08:38:34 -0700 Tony Lindgren <tony@atomide.com> wrote:
> 
> > > drivers/power/twl4030_charger.c: In function 'twl4030_charger_enable_usb':
> > > drivers/power/twl4030_charger.c:192:20: warning: ignoring return value of 'regulator_enable', declared with attribute warn_unused_result
> > 
> > Neil, care to provide a fix for this? It's from your commit ab37813
> > (twl4030_charger: Allow charger to control the regulator that feeds it).
> > 
> >
> This the sort of thing that might be appropriate?

Thanks looks good to me. Care to send it to the appropriate
mailing lists and maintainers for drivers/power?

Regards,

Tony
 
> From: NeilBrown <neilb@suse.de>
> Date: Mon, 6 May 2013 12:35:59 +1000
> Subject: [PATCH] twl4030_charger: don't ignore regulator_enable()
> 
> regulator_enable() doesn't like being ignored.  If it does fail there
> is nothing we can do except not set usb_enabled (which is necessary
> else a subsequent regulator_disable() will be unbalanced).
> 
> We cannot usefully return an error here as errors from
> twl4030_charger_enable_usb() are ignored.
> 
> Signed-off-by: NeilBrown <neilb@suse.de>
> 
> diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
> index bed4581..8b0ec70 100644
> --- a/drivers/power/twl4030_charger.c
> +++ b/drivers/power/twl4030_charger.c
> @@ -189,8 +189,8 @@ static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable)
>  
>  		/* Need to keep regulator on */
>  		if (!bci->usb_enabled) {
> -			regulator_enable(bci->usb_reg);
> -			bci->usb_enabled = 1;
> +			if (regulator_enable(bci->usb_reg) == 0)
> +				bci->usb_enabled = 1;
>  		}
>  
>  		/* forcing the field BCIAUTOUSB (BOOT_BCI[1]) to 1 */


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

Patch

diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index bed4581..8b0ec70 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -189,8 +189,8 @@  static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable)
 
 		/* Need to keep regulator on */
 		if (!bci->usb_enabled) {
-			regulator_enable(bci->usb_reg);
-			bci->usb_enabled = 1;
+			if (regulator_enable(bci->usb_reg) == 0)
+				bci->usb_enabled = 1;
 		}
 
 		/* forcing the field BCIAUTOUSB (BOOT_BCI[1]) to 1 */