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, 11 Nov 2014 13:26:36 +0100
From:	Johan Hovold <johan@...nel.org>
To:	Octavian Purdila <octavian.purdila@...el.com>
Cc:	lee.jones@...aro.org, laurentiu.palcu@...el.com, johan@...nel.org,
	wsa@...-dreams.de, julia.lawall@...6.fr, linux-i2c@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] i2c: dln2: simplify return flow for dln2_i2c_enable

On Tue, Nov 11, 2014 at 02:20:57PM +0200, Octavian Purdila wrote:
> This fixes the following kbuild test robot warning:
> 
> >> drivers/i2c/busses/i2c-dln2.c:70:1-4: WARNING: end returns can be simplified if negative or 0 value
> 
> Reported-by: kbuild test robot <fengguang.wu@...el.com>
> Reported-by: Julia Lawall <julia.lawall@...6.fr>
> 
> Signed-off-by: Octavian Purdila <octavian.purdila@...el.com>
> ---
>  drivers/i2c/busses/i2c-dln2.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-dln2.c b/drivers/i2c/busses/i2c-dln2.c
> index 010a5fa..b3fb86a 100644
> --- a/drivers/i2c/busses/i2c-dln2.c
> +++ b/drivers/i2c/busses/i2c-dln2.c
> @@ -54,7 +54,6 @@ struct dln2_i2c {
>  
>  static int dln2_i2c_enable(struct dln2_i2c *dln2, bool enable)
>  {
> -	int ret;
>  	u16 cmd;
>  	struct {
>  		u8 port;
> @@ -67,11 +66,7 @@ static int dln2_i2c_enable(struct dln2_i2c *dln2, bool enable)
>  	else
>  		cmd = DLN2_I2C_DISABLE;
>  
> -	ret = dln2_transfer_tx(dln2->pdev, cmd, &tx, sizeof(tx));
> -	if (ret < 0)
> -		return ret;
> -
> -	return 0;
> +	return dln2_transfer_tx(dln2->pdev, cmd, &tx, sizeof(tx));

This looks like a bogus warning. It's not generally equivalent (ret > 0)
and is not mandated by any style guide lines.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ