Skip to contentSkip to conversation

wl3501_cs: Remove unnecessary NULL check

PATCH In review Alex Dewar 2 participants 2 messages Sep 26, 2020 – Sep 29, 2020

Subsystems (3)
lore
Share & tools
lore

Alex Dewar

author
#0 lore raw

PATCH 1/1 wl3501_cs: Remove unnecessary NULL check

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)

---
 drivers/net/wireless/wl3501_cs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/wl3501_cs.c +1 -3
index 4e7a2140649b..026e88b80bfc 100644
@@ -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,
Signature · 1 line
2.28.0
#1 lore raw
Quoted 6 lines · Alex Dewar

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)

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

1d2a85382282 wl3501_cs: Remove unnecessary NULL check

Signature · 3 lines
https://patchwork.kernel.org/patch/11801615/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches