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  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:   Sun, 10 Oct 2021 11:56:01 +0300
From:   Pavel Skripkin <paskripkin@...il.com>
To:     Saurav Girepunje <saurav.girepunje@...il.com>,
        gregkh@...uxfoundation.org, fabioaiuto83@...il.com,
        ross.schm.dev@...il.com, marcocesati@...il.com,
        insafonov@...il.com, linux-staging@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Cc:     saurav.girepunje@...mail.com
Subject: Re: [PATCH v2] staging: rtl8723bs: os_dep: simplify the return
 statement.

On 10/10/21 08:06, Saurav Girepunje wrote:
> Remove the unneeded and redundant check of variable on goto out.
> Simplify the return using multiple goto label to avoid
> unneeded check.
> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@...il.com>

[code snip]

>   	ret = cfg80211_register_netdevice(mon_ndev);
>   	if (ret) {
> -		goto out;
> +		goto err_register;
>   	}
> 
>   	*ndev = pwdev_priv->pmon_ndev = mon_ndev;
>   	memcpy(pwdev_priv->ifname_mon, name, IFNAMSIZ+1);
> +	goto out;
> 


This looks confusing for readers. This is success path and ret is 
guaranteed to be 0 at this point, so isn't `return 0;` enough here?

Thanks


> +out:
>   	return ret;
>   }
> 



With regards,
Pavel Skripkin

Powered by blists - more mailing lists