* [PATCH] staging: r8188eu: Remove redundant code from rtw_free_netdev()
@ 2022-04-02 14:06 Fabio M. De Francesco
0 siblings, 0 replies; only message in thread
From: Fabio M. De Francesco @ 2022-04-02 14:06 UTC (permalink / raw)
To: Larry Finger, Phillip Potter, Greg Kroah-Hartman, linux-staging,
linux-kernel, outreachy
Cc: Fabio M. De Francesco, Pavel Skripkin, Martin Kaiser
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>
---
drivers/staging/r8188eu/os_dep/osdep_service.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/staging/r8188eu/os_dep/osdep_service.c b/drivers/staging/r8188eu/os_dep/osdep_service.c
index 7a6fcc96081a..fc10eefe04a9 100644
--- a/drivers/staging/r8188eu/os_dep/osdep_service.c
+++ b/drivers/staging/r8188eu/os_dep/osdep_service.c
@@ -116,19 +116,10 @@ void rtw_free_netdev(struct net_device *netdev)
{
struct rtw_netdev_priv_indicator *pnpi;
- if (!netdev)
- goto RETURN;
-
pnpi = netdev_priv(netdev);
- if (!pnpi->priv)
- goto RETURN;
-
vfree(pnpi->priv);
free_netdev(netdev);
-
-RETURN:
- return;
}
int rtw_change_ifname(struct adapter *padapter, const char *ifname)
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-02 14:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-02 14:06 [PATCH] staging: r8188eu: Remove redundant code from rtw_free_netdev() Fabio M. De Francesco
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®