Skip to contentSkip to conversation

staging: wilc1000: remove 'if' on field address

PATCH In review Dafna Hirschfeld 2 participants 2 messages Feb 22, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: wilc1000: remove 'if' on field address

Remove 'if' statements testing struct's field address. Since such statements always return true, they are redundant.

---
 drivers/staging/wilc1000/linux_wlan.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +4 -9
index d9725ef..cf746f2 100644
@@ -628,8 +628,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 			wl->hif_func->disable_interrupt(wl);
 			mutex_unlock(&wl->hif_cs);
 		}
-		if (&wl->txq_event)
-			complete(&wl->txq_event);
+		complete(&wl->txq_event);
 
 		wlan_deinitialize_threads(dev);
 		deinit_irq(dev);
@@ -677,11 +676,8 @@ static int wlan_deinit_locks(struct net_device *dev)
 	vif = netdev_priv(dev);
 	wilc = vif->wilc;
 
-	if (&wilc->hif_cs)
-		mutex_destroy(&wilc->hif_cs);
-
-	if (&wilc->rxq_cs)
-		mutex_destroy(&wilc->rxq_cs);
+	mutex_destroy(&wilc->hif_cs);
+	mutex_destroy(&wilc->rxq_cs);
 
 	return 0;
 }
@@ -716,8 +712,7 @@ static void wlan_deinitialize_threads(struct net_device *dev)
 
 	wl->close = 1;
 
-	if (&wl->txq_event)
-		complete(&wl->txq_event);
+	complete(&wl->txq_event);
 
 	if (wl->txq_thread) {
 		kthread_stop(wl->txq_thread);
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Dafna Hirschfeld

Remove 'if' statements testing struct's field address. Since such statements always return true, they are redundant.

Good catch :)

Quoted 52 lines
---
 drivers/staging/wilc1000/linux_wlan.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/linux_wlan.c +4 -10
index d9725ef..cf746f2 100644
@@ -628,8 +628,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
 			wl->hif_func->disable_interrupt(wl);
 			mutex_unlock(&wl->hif_cs);
 		}
-		if (&wl->txq_event)
-			complete(&wl->txq_event);
+		complete(&wl->txq_event);
 
 		wlan_deinitialize_threads(dev);
 		deinit_irq(dev);
@@ -677,11 +676,8 @@ static int wlan_deinit_locks(struct net_device *dev)
 	vif = netdev_priv(dev);
 	wilc = vif->wilc;
 
-	if (&wilc->hif_cs)
-		mutex_destroy(&wilc->hif_cs);
-
-	if (&wilc->rxq_cs)
-		mutex_destroy(&wilc->rxq_cs);
+	mutex_destroy(&wilc->hif_cs);
+	mutex_destroy(&wilc->rxq_cs);
 
 	return 0;
 }
@@ -716,8 +712,7 @@ static void wlan_deinitialize_threads(struct net_device *dev)
 
 	wl->close = 1;
 
-	if (&wl->txq_event)
-		complete(&wl->txq_event);
+	complete(&wl->txq_event);
 
 	if (wl->txq_thread) {
 		kthread_stop(wl->txq_thread);
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20180222071009.GA4082%40gmail.com.
For more options, visit https://groups.google.com/d/optout.