Subject: Latest build results - errors/warnings - lots of them

From: [email-masked] (Tony Lindgren)
Date: Wed, 8 May 2013 15:17:20 -0700

* NeilBrown <[email-masked]> [130505 19:45]:
> On Thu, 2 May 2013 08:38:34 -0700 Tony Lindgren <[email-masked]> 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 <[email-masked]>
> 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 <[email-masked]>
> 
> 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 */