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] [day] [month] [year] [list]
Message-id: <008d01ce1eb3$c1a1d1b0$44e57510$%han@samsung.com>
Date:	Tue, 12 Mar 2013 08:54:23 +0900
From:	Jingoo Han <jg1.han@...sung.com>
To:	'Andrew Morton' <akpm@...ux-foundation.org>
Cc:	'LKML' <linux-kernel@...r.kernel.org>,
	'Richard Purdie' <rpurdie@...ys.net>,
	'Jingoo Han' <jg1.han@...sung.com>
Subject: Re: [PATCH] backlight: l4f00242t03: check return value of
 regulator_enable()

On Tuesday, March 12, 2013 7:28 AM, Andrew Morton wrote:
> 
> On Mon, 11 Mar 2013 12:58:41 +0900 Jingoo Han <jg1.han@...sung.com> wrote:
> 
> > The regulator_enable() was marked as as __must_check, therefore,
> > the return value of regulator_enable() should be checked.
> > Also, this patch checks return value of regulator_set_voltage().
> >
> > Signed-off-by: Jingoo Han <jg1.han@...sung.com>
> > ---
> >  drivers/video/backlight/l4f00242t03.c |   27 ++++++++++++++++++++++-----
> >  1 files changed, 22 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
> > index fb61557..8d54c3c 100644
> > --- a/drivers/video/backlight/l4f00242t03.c
> > +++ b/drivers/video/backlight/l4f00242t03.c
> > @@ -51,14 +51,31 @@ static void l4f00242t03_lcd_init(struct spi_device *spi)
> >  	struct l4f00242t03_pdata *pdata = spi->dev.platform_data;
> >  	struct l4f00242t03_priv *priv = spi_get_drvdata(spi);
> >  	const u16 cmd[] = { 0x36, param(0), 0x3A, param(0x60) };
> > +	int ret;
> >
> >  	dev_dbg(&spi->dev, "initializing LCD\n");
> >
> > -	regulator_set_voltage(priv->io_reg, 1800000, 1800000);
> > -	regulator_enable(priv->io_reg);
> > +	ret = regulator_set_voltage(priv->io_reg, 1800000, 1800000);
> > +	if (ret) {
> > +		dev_err(&spi->dev, "failed to set the IO regulator voltage.\n");
> > +		return;
> > +	}
> > +	ret = regulator_enable(priv->io_reg);
> > +	if (ret) {
> > +		dev_err(&spi->dev, "failed to enable the IO regulator.\n");
> > +		return;
> > +	}
> >
> > -	regulator_set_voltage(priv->core_reg, 2800000, 2800000);
> > -	regulator_enable(priv->core_reg);
> > +	ret = regulator_set_voltage(priv->core_reg, 2800000, 2800000);
> > +	if (ret) {
> > +		dev_err(&spi->dev, "failed to set the core regulator voltage.\n");
> > +		return;
> 
> Should the IO regulator be disabled before returning?
Hi Andrew,

OK, I see.
I will send v2 patch.
Thank you :)

Best regards,
Jingoo Han

> 
> > +	}
> > +	ret = regulator_enable(priv->core_reg);
> > +	if (ret) {
> > +		dev_err(&spi->dev, "failed to enable the core regulator.\n");
> > +		return;
> > +	}
> 
> Ditto.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ