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: <75b174d3-14cc-15c9-ab01-b2e2faa296de@samsung.com>
Date:   Thu, 15 Sep 2016 13:48:08 +0200
From:   Jacek Anaszewski <j.anaszewski@...sung.com>
To:     Heiner Kallweit <hkallweit1@...il.com>
Cc:     "linux-leds@...r.kernel.org" <linux-leds@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/6] leds: gpio: fix an unhandled error case in
 create_gpio_led

Hi Heiner,

On 09/13/2016 08:53 PM, Heiner Kallweit wrote:
> gpiod_get_value_cansleep returns 0, 1, or an error code.
> So far errors are not handled and treated the same as 1.
> Change this to bail out if an error code is returned and
> remove the double negation.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
> ---
>  drivers/leds/leds-gpio.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 3599b2e..10c851e 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -118,10 +118,13 @@ static int create_gpio_led(const struct gpio_led *template,
>  		led_dat->platform_gpio_blink_set = blink_set;
>  		led_dat->cdev.blink_set = gpio_blink_set;
>  	}
> -	if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP)
> -		state = !!gpiod_get_value_cansleep(led_dat->gpiod);
> -	else
> +	if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) {
> +		state = gpiod_get_value_cansleep(led_dat->gpiod);
> +		if (state < 0)
> +			return state;
> +	} else {
>  		state = (template->default_state == LEDS_GPIO_DEFSTATE_ON);
> +	}
>  	led_dat->cdev.brightness = state ? LED_FULL : LED_OFF;
>  	if (!template->retain_state_suspended)
>  		led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
>

Thanks for the updated patch set. Applied.

-- 
Best regards,
Jacek Anaszewski

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ