All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: wilc1000: remove 'if' on field address
@ 2018-02-22  7:10 Dafna Hirschfeld
  2018-02-22  8:04 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Dafna Hirschfeld @ 2018-02-22  7:10 UTC (permalink / raw)
  To: aditya.shankar, ganesh.krishna, gregkh; +Cc: outreachy-kernel

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

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
---
 drivers/staging/wilc1000/linux_wlan.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
index d9725ef..cf746f2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Outreachy kernel] [PATCH] staging: wilc1000: remove 'if' on field address
  2018-02-22  7:10 [PATCH] staging: wilc1000: remove 'if' on field address Dafna Hirschfeld
@ 2018-02-22  8:04 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2018-02-22  8:04 UTC (permalink / raw)
  To: Dafna Hirschfeld; +Cc: aditya.shankar, ganesh.krishna, gregkh, outreachy-kernel



On Thu, 22 Feb 2018, Dafna Hirschfeld wrote:

> Remove 'if' statements testing struct's field address.
> Since such statements always return true, they are redundant.
>
> Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

Good catch :)

> ---
>  drivers/staging/wilc1000/linux_wlan.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c
> index d9725ef..cf746f2 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-22  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22  7:10 [PATCH] staging: wilc1000: remove 'if' on field address Dafna Hirschfeld
2018-02-22  8:04 ` [Outreachy kernel] " Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.