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] [thread-next>] [day] [month] [year] [list]
Message-ID: <19399d81-d61c-9287-3081-e1da5a833984@redhat.com>
Date:   Mon, 16 Oct 2023 17:35:38 +0200
From:   Hans de Goede <hdegoede@...hat.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Pavel Machek <pavel@....cz>, Lee Jones <lee@...nel.org>,
        Denis Osterland-Heim <denis.osterland@...hl.com>
Subject: Re: [PATCH v2 1/1] leds: core: Refactor led_update_brightness() to
 use standard pattern

Hi,

On 10/16/23 17:30, Andy Shevchenko wrote:
> The standard conditional pattern is to check for errors first and
> bail out if any. Refactor led_update_brightness() accordingly.
> 
> While at it, drop unneeded assignment and return 0 unconditionally
> on success.
> 
> Acked-by: Denis Osterland-Heim <denis.osterland@...hl.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@...hat.com>

Regards,

Hans



> ---
> v2: added tag (Denis), Cc'ed to the updated list of LED maintainers
>  drivers/leds/led-core.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
> index 2230239283d0..89c9806cc97f 100644
> --- a/drivers/leds/led-core.c
> +++ b/drivers/leds/led-core.c
> @@ -364,17 +364,17 @@ EXPORT_SYMBOL_GPL(led_set_brightness_sync);
>  
>  int led_update_brightness(struct led_classdev *led_cdev)
>  {
> -	int ret = 0;
> +	int ret;
>  
>  	if (led_cdev->brightness_get) {
>  		ret = led_cdev->brightness_get(led_cdev);
> -		if (ret >= 0) {
> -			led_cdev->brightness = ret;
> -			return 0;
> -		}
> +		if (ret < 0)
> +			return ret;
> +
> +		led_cdev->brightness = ret;
>  	}
>  
> -	return ret;
> +	return 0;
>  }
>  EXPORT_SYMBOL_GPL(led_update_brightness);
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ