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]
Date:   Tue, 9 Mar 2021 13:30:45 +0100
From:   Rodolfo Giometti <giometti@...eenne.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-kernel@...r.kernel.org
Cc:     Ryan Govostes <rgovostes@...i.edu>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional
 stuff in pps_gpio_setup()

On 09/03/21 12:24, Andy Shevchenko wrote:
> Rearrange optional stuff in pps_gpio_setup() so it will go after mandatory one
> and with reduced indentation. This will increase readability of the sources.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/pps/clients/pps-gpio.c | 33 ++++++++++++++++++---------------
>  1 file changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index b097da5a659a..35799e6401c9 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -110,28 +110,31 @@ static int pps_gpio_setup(struct device *dev)
>  		return dev_err_probe(dev, PTR_ERR(data->gpio_pin),
>  				     "failed to request PPS GPIO\n");
>  
> +	data->assert_falling_edge =
> +		device_property_read_bool(dev, "assert-falling-edge");
> +
>  	data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW);
>  	if (IS_ERR(data->echo_pin))
>  		return dev_err_probe(dev, PTR_ERR(data->echo_pin),
>  				     "failed to request ECHO GPIO\n");
>  
> -	if (data->echo_pin) {
> -		ret = device_property_read_u32(dev, "echo-active-ms", &value);
> -		if (ret) {
> -			dev_err(dev, "failed to get echo-active-ms from FW\n");
> -			return ret;
> -		}
> -		data->echo_active_ms = value;
> -		/* sanity check on echo_active_ms */
> -		if (!data->echo_active_ms || data->echo_active_ms > 999) {
> -			dev_err(dev, "echo-active-ms: %u - bad value from FW\n",
> -				data->echo_active_ms);
> -			return -EINVAL;
> -		}
> +	if (!data->echo_pin)
> +		return 0;
> +
> +	ret = device_property_read_u32(dev, "echo-active-ms", &value);
> +	if (ret) {
> +		dev_err(dev, "failed to get echo-active-ms from FW\n");
> +		return ret;
>  	}
>  
> -	data->assert_falling_edge =
> -		device_property_read_bool(dev, "assert-falling-edge");
> +	/* sanity check on echo_active_ms */
> +	if (!value || value > 999) {
> +		dev_err(dev, "echo-active-ms: %u - bad value from FW\n", value);
> +		return -EINVAL;
> +	}
> +
> +	data->echo_active_ms = value;
> +
>  	return 0;
>  }
>  
> 

Acked-by: Rodolfo Giometti <giometti@...eenne.com>

-- 
GNU/Linux Solutions                  e-mail: giometti@...eenne.com
Linux Device Driver                          giometti@...ux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ