lkml.org 
[lkml]   [2021]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2] staging: rtl8723bs: os_dep: simplify the return statement.
From
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@gmail.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

\
 
 \ /
  Last update: 2021-10-10 10:57    [W:0.119 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site