diff mbox series

wl3501_cs: Remove unnecessary NULL check

Message ID 20200926174558.9436-1-alex.dewar90@gmail.com (mailing list archive)
State Accepted
Commit 1d2a85382282e7c77cbde5650335c3ffc6073fa1
Delegated to: Kalle Valo
Headers show
Series wl3501_cs: Remove unnecessary NULL check | expand

Commit Message

Alex Dewar Sept. 26, 2020, 5:45 p.m. UTC
In wl3501_detach(), link->priv is checked for a NULL value before being
passed to free_netdev(). However, it cannot be NULL at this point as it
has already been passed to other functions, so just remove the check.

Addresses-Coverity: CID 710499: Null pointer dereferences (REVERSE_INULL)
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 drivers/net/wireless/wl3501_cs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Kalle Valo Sept. 29, 2020, 8:25 a.m. UTC | #1
Alex Dewar <alex.dewar90@gmail.com> wrote:

> In wl3501_detach(), link->priv is checked for a NULL value before being
> passed to free_netdev(). However, it cannot be NULL at this point as it
> has already been passed to other functions, so just remove the check.
> 
> Addresses-Coverity: CID 710499: Null pointer dereferences (REVERSE_INULL)
> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>

Patch applied to wireless-drivers-next.git, thanks.

1d2a85382282 wl3501_cs: Remove unnecessary NULL check
diff mbox series

Patch

diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 4e7a2140649b..026e88b80bfc 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -1433,9 +1433,7 @@  static void wl3501_detach(struct pcmcia_device *link)
 	wl3501_release(link);
 
 	unregister_netdev(dev);
-
-	if (link->priv)
-		free_netdev(link->priv);
+	free_netdev(dev);
 }
 
 static int wl3501_get_name(struct net_device *dev, struct iw_request_info *info,