All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: stable@vger.kernel.org,
	Wei Yongjun <yongjun_wei@trendmicro.com.cn>,
	Jacek Anaszewski <j.anaszewski@samsung.com>
Subject: Re: [PATCH stable v4.4+ 3/3] leds: leds-gpio: Fix return value check in create_gpio_led()
Date: Thu, 6 Dec 2018 11:04:29 +0100	[thread overview]
Message-ID: <20181206100429.GA11518@kroah.com> (raw)
In-Reply-To: <1544089622-23982-3-git-send-email-krzk@kernel.org>

On Thu, Dec 06, 2018 at 10:47:02AM +0100, Krzysztof Kozlowski wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> commit 2d88a331e48095cf60ad9bdf3177bd401bf99727 upstream.
> 
> In case of error, the function gpio_to_desc() returns NULL
> pointer not ERR_PTR(). The IS_ERR() test in the return value
> check should be replaced with NULL test.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/leds/leds-gpio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

All 3 now queued up, thanks.

greg k-h
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 5db4515a4fd7..df186b38da78 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -118,8 +118,8 @@ static int create_gpio_led(const struct gpio_led *template,
>  			return ret;
>  
>  		led_dat->gpiod = gpio_to_desc(template->gpio);
> -		if (IS_ERR(led_dat->gpiod))
> -			return PTR_ERR(led_dat->gpiod);
> +		if (!led_dat->gpiod)
> +			return -EINVAL;
>  	}
>  
>  	led_dat->cdev.name = template->name;
> -- 
> 2.7.4
> 

      reply	other threads:[~2018-12-06 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06  9:47 [PATCH stable v4.4+ 1/3] leds: call led_pwm_set() in leds-pwm to enforce default LED_OFF Krzysztof Kozlowski
2018-12-06  9:47 ` [PATCH stable v4.4+ 2/3] leds: turn off the LED and wait for completion on unregistering LED class device Krzysztof Kozlowski
2018-12-06  9:47 ` [PATCH stable v4.4+ 3/3] leds: leds-gpio: Fix return value check in create_gpio_led() Krzysztof Kozlowski
2018-12-06 10:04   ` Greg KH [this message]

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=20181206100429.GA11518@kroah.com \
    --to=greg@kroah.com \
    --cc=j.anaszewski@samsung.com \
    --cc=krzk@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yongjun_wei@trendmicro.com.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.