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: <f066439f-57d1-7ccf-3d3c-546aa90a17bb@linux.intel.com>
Date: Fri, 12 Jan 2024 10:29:43 +0200 (EET)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
cc: Hans de Goede <hdegoede@...hat.com>, Henry Shi <henryshi2018@...il.com>, 
    platform-driver-x86@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>, 
    kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v2] platform/x86: silicom-platform: clean up a check

On Fri, 12 Jan 2024, Dan Carpenter wrote:

> The error message in this code can't be reached because value is either
> zero or non-zero.  There isn't a third option.  Really, it's nicer to
> write this as a one liner.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>  drivers/platform/x86/silicom-platform.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/platform/x86/silicom-platform.c b/drivers/platform/x86/silicom-platform.c
> index 6ce43ccb3112..c0910af16a3a 100644
> --- a/drivers/platform/x86/silicom-platform.c
> +++ b/drivers/platform/x86/silicom-platform.c
> @@ -256,12 +256,7 @@ static void silicom_gpio_set(struct gpio_chip *gc,
>  	if (direction == GPIO_LINE_DIRECTION_IN)
>  		return;
>  
> -	if (value)
> -		silicom_mec_port_set(channel, 0);
> -	else if (value == 0)
> -		silicom_mec_port_set(channel, 1);
> -	else
> -		pr_err("Wrong argument value: %d\n", value);
> +	silicom_mec_port_set(channel, !value);
>  }
>  
>  static int silicom_gpio_direction_output(struct gpio_chip *gc,
> 

Thanks for the update,

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>

-- 
 i.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ