Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: r8188eu: Remove redundant code from rtw_free_netdev()

In rtw_free_netdev() there are two redundant tests. The first checks for
a valid pointer to a "struct net_device". This pointer is the argument
of rtw_free_netdev(). The two callers of this function already test this
parameter immediatelly before the calls. The second checks for a valid
pointer to a "struct rtw_netdev_priv_indicator". This pointer is always
valid and, even if it were not, vfree() is a no-op on NULL pointers.

Therefore the above-mentioned two "if" statements are unnecessary and
redundant. For this reason, remove these two tests.

After removing these tests there is no more need of the "RETURN" label.
Therefore, remove also the "RETURN" label.

Cc: Pavel Skripkin <paskripkin@gmail.com>
Cc: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220402140657.10549-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Fabio M. De Francesco and committed by
Greg Kroah-Hartman
28f7545d e25abea6

-9
-9
drivers/staging/r8188eu/os_dep/osdep_service.c
··· 116 116 { 117 117 struct rtw_netdev_priv_indicator *pnpi; 118 118 119 - if (!netdev) 120 - goto RETURN; 121 - 122 119 pnpi = netdev_priv(netdev); 123 - 124 - if (!pnpi->priv) 125 - goto RETURN; 126 120 127 121 vfree(pnpi->priv); 128 122 free_netdev(netdev); 129 - 130 - RETURN: 131 - return; 132 123 } 133 124 134 125 int rtw_change_ifname(struct adapter *padapter, const char *ifname)