All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: leds-gpio: Fix return value check in create_gpio_led()
@ 2016-02-06 14:37 weiyj_lk
  2016-02-08  8:09 ` Jacek Anaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: weiyj_lk @ 2016-02-06 14:37 UTC (permalink / raw)
  To: Richard Purdie, Jacek Anaszewski; +Cc: Wei Yongjun, linux-leds

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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>
---
 drivers/leds/leds-gpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 7bc5328..5883ded 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -104,8 +104,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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] leds: leds-gpio: Fix return value check in create_gpio_led()
  2016-02-06 14:37 [PATCH] leds: leds-gpio: Fix return value check in create_gpio_led() weiyj_lk
@ 2016-02-08  8:09 ` Jacek Anaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Jacek Anaszewski @ 2016-02-08  8:09 UTC (permalink / raw)
  To: weiyj_lk; +Cc: Richard Purdie, Wei Yongjun, linux-leds

Hi Wei,

On 02/06/2016 03:37 PM, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> 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>
> ---
>   drivers/leds/leds-gpio.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 7bc5328..5883ded 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -104,8 +104,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;
>
>
>

Thanks for the patch, applied.

-- 
Best Regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-08  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-06 14:37 [PATCH] leds: leds-gpio: Fix return value check in create_gpio_led() weiyj_lk
2016-02-08  8:09 ` Jacek Anaszewski

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.