Re: [PATCH] staging: r8188eu: Remove goto to no-op exit label

Ira Weiny
2022-04-01T20:41:45Z

On Fri, Apr 01, 2022 at 08:35:13PM +0200, Fabio M. De Francesco wrote:
> In function rtw_free_netdev() there are two "goto" jumps to a no-op exit
> label called "RETURN". Remove the label and return in line.

Thanks for the patch! However, A good commit message lists the why and what of
a change. I don't see a why for this commit?

FWIW (For what it's worth) I know of a couple of good reasons for this change
but you should get in the habit of putting that in the commit message. Even
for obvious things like this.

Anyway, I think this patch can stand on it's own with an updated commit
message. However, see below...

>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> ---
> drivers/staging/r8188eu/os_dep/osdep_service.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/os_dep/osdep_service.c b/drivers/staging/r8188eu/os_dep/osdep_service.c
> index 7a6fcc96081a..d680bfba7f5d 100644
> --- a/drivers/staging/r8188eu/os_dep/osdep_service.c
> +++ b/drivers/staging/r8188eu/os_dep/osdep_service.c
> @@ -117,18 +117,15 @@ void rtw_free_netdev(struct net_device *netdev)
> struct rtw_netdev_priv_indicator *pnpi;
>
> if (!netdev)
> - goto RETURN;
> + return;
>
> pnpi = netdev_priv(netdev);
>
> if (!pnpi->priv)
> - goto RETURN;
> + return;

This does not look right. If netdev is not NULL why does this function skip
free_netdev()?

Fabio could you follow up with Larry and/or Phillip and see why the code does
this? To me it looks like a potential bug.

Thanks!
Ira

>
> vfree(pnpi->priv);
> free_netdev(netdev);
> -
> -RETURN:
> - return;
> }
>
> int rtw_change_ifname(struct adapter *padapter, const char *ifname)
> --
> 2.34.1
>