lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 18 May 2012 12:46:51 +1000
From:	NeilBrown <neilb@...e.de>
To:	Andi Shyti <andi.shyti@...il.com>
Cc:	Samuel Ortiz <sameo@...ux.intel.com>, Felipe Balbi <balbi@...com>,
	Anton Vorontsov <cbou@...l.ru>,
	David Woodhouse <dwmw2@...radead.org>,
	Grazvydas Ignotas <notasas@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
	Tero Kristo <t-kristo@...com>
Subject: Re: [PATCH 3/4] power_supply/MFD: twl4030_charger: Allow charger to
 control the regulator that feeds it.

On Sun, 13 May 2012 20:12:08 +0200 Andi Shyti <andi.shyti@...il.com> wrote:

> Hi Neil,
> 
> On Wed, May 09, 2012 at 07:40:40AM +1000, NeilBrown wrote:
> > @@ -183,6 +186,12 @@ static int twl4030_charger_enable_usb(struct twl4030_bci *bci, bool enable)
> >  			return -EACCES;
> >  		}
> >  
> > +		/* Need to keep regulator on */
> > +		if (!bci->usb_enabled) {
> > +			regulator_enable(bci->usb_reg);
> 
> Should you consider here a failure case?

Probably.  Something like this?

+		/* Need to keep regulator on */
+		if (!bci->usb_enabled &&
+		    bci->usb_reg &&
+		    regulator_enable(bci->usb_reg) == 0)
+			bci->usb_enabled = 1;
+

> 
> > +			bci->usb_enabled = 1;
> > +		}
> > +
> >  		/* forcing the field BCIAUTOUSB (BOOT_BCI[1]) to 1 */
> >  		ret = twl4030_clear_set_boot_bci(0, TWL4030_BCIAUTOUSB);
> >  		if (ret < 0)
> > @@ -511,6 +524,8 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
> >  	bci->usb.num_properties = ARRAY_SIZE(twl4030_charger_props);
> >  	bci->usb.get_property = twl4030_bci_get_property;
> >  
> > +	bci->usb_reg = regulator_get(bci->dev, "bci3v1");
> 
> ... and here.

In what circumstances can that fail, I wonder.
Still, maybe this is best:


+	bci->usb_reg = regulator_get(bci->dev, "bci3v1");
+	if (IS_ERR(bci->usb_reg)) {
+		dev_warn(&bci->dev, "regulator get bci3v1 failed\n");
+		bci->usb_reg = NULL;
+	}
+

Thanks,
NeilBrown

Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ