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: <ff3a0662-a71b-79d5-6d28-a882f9f77f89@gmail.com>
Date:   Thu, 29 Aug 2019 22:04:18 +0200
From:   Jacek Anaszewski <jacek.anaszewski@...il.com>
To:     Dan Murphy <dmurphy@...com>, pavel@....cz
Cc:     linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: lm3532: Fix optional led-max-microamp prop error
 handling

Hi Dan,

Thanks for the update.

On 8/29/19 9:18 PM, Dan Murphy wrote:
> Fix the error handling for the led-max-microamp property.
> Need to check if the property is present and then if it is
> retrieve the setting and its max boundary
> 
> Reported-by: Pavel Machek <pavel@....cz>
> Signed-off-by: Dan Murphy <dmurphy@...com>
> ---
>  drivers/leds/leds-lm3532.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
> index c5cfd8e3f15f..13b4265fb85a 100644
> --- a/drivers/leds/leds-lm3532.c
> +++ b/drivers/leds/leds-lm3532.c
> @@ -601,11 +601,15 @@ static int lm3532_parse_node(struct lm3532_data *priv)
>  			goto child_out;
>  		}
>  
> -		ret = fwnode_property_read_u32(child, "led-max-microamp",
> -					       &led->full_scale_current);
> -
> -		if (led->full_scale_current > LM3532_FS_CURR_MAX)
> -			led->full_scale_current = LM3532_FS_CURR_MAX;
> +		if (fwnode_property_present(child, "led-max-microamp")) {
> +			if (fwnode_property_read_u32(child, "led-max-microamp",
> +						     &led->full_scale_current))
> +				dev_err(&priv->client->dev,
> +					"Failed getting led-max-microamp\n");
> +
> +			if (led->full_scale_current > LM3532_FS_CURR_MAX)
> +				led->full_scale_current = LM3532_FS_CURR_MAX;

One more nit: we have min() macro in kernel.h for such things.

> +		}
>  
>  		if (led->mode == LM3532_BL_MODE_ALS) {
>  			led->mode = LM3532_ALS_CTRL;
> 

-- 
Best regards,
Jacek Anaszewski

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ