mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jingoo Han <jg1.han@samsung.com>
Cc: "'LKML'" <linux-kernel@vger.kernel.org>,
	"'Richard Purdie'" <rpurdie@rpsys.net>
Subject: Re: [PATCH] backlight: l4f00242t03: check return value of regulator_enable()
Date: Mon, 11 Mar 2013 15:28:01 -0700	[thread overview]
Message-ID: <20130311152801.fd07ff051885bb1c98fe14f5@linux-foundation.org> (raw)
In-Reply-To: <005f01ce1e0c$b7dbcfc0$27936f40$%han@samsung.com>

On Mon, 11 Mar 2013 12:58:41 +0900 Jingoo Han <jg1.han@samsung.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@samsung.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?

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

Ditto.

  reply	other threads:[~2013-03-11 22:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11  3:58 Jingoo Han
2013-03-11 22:28 ` Andrew Morton [this message]
2013-03-11 23:54   ` Jingoo Han

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130311152801.fd07ff051885bb1c98fe14f5@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=jg1.han@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®