linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: ti: remove redundant NULL check.
@ 2013-02-12 21:54 Cyril Roelandt
  2013-02-12 22:06 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Cyril Roelandt @ 2013-02-12 21:54 UTC (permalink / raw)
  To: davem
  Cc: linux-kernel, kernel-janitors, mugunthanvnm, zonque, hotforest,
	Julia.Lawall, netdev, Cyril Roelandt

cpdma_chan_destroy() on a NULL pointer is a no-op, so the NULL check in
cpdma_ctlr_destroy() can safely be removed.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
---
 drivers/net/ethernet/ti/davinci_cpdma.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index f862918..aba787b 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -450,8 +450,7 @@ int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr)
 		cpdma_ctlr_stop(ctlr);
 
 	for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++) {
-		if (ctlr->channels[i])
-			cpdma_chan_destroy(ctlr->channels[i]);
+		cpdma_chan_destroy(ctlr->channels[i]);
 	}
 
 	cpdma_desc_pool_destroy(ctlr->pool);
-- 
1.7.10.4


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

* Re: [PATCH] net: ethernet: ti: remove redundant NULL check.
  2013-02-12 21:54 [PATCH] net: ethernet: ti: remove redundant NULL check Cyril Roelandt
@ 2013-02-12 22:06 ` David Miller
  2013-02-12 22:52   ` Cyril Roelandt
  2013-02-12 22:54   ` Cyril Roelandt
  0 siblings, 2 replies; 6+ messages in thread
From: David Miller @ 2013-02-12 22:06 UTC (permalink / raw)
  To: tipecaml
  Cc: linux-kernel, kernel-janitors, mugunthanvnm, zonque, hotforest,
	Julia.Lawall, netdev

From: Cyril Roelandt <tipecaml@gmail.com>
Date: Tue, 12 Feb 2013 22:54:46 +0100

> cpdma_chan_destroy() on a NULL pointer is a no-op, so the NULL check in
> cpdma_ctlr_destroy() can safely be removed.
> 
> Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
 ...
> @@ -450,8 +450,7 @@ int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr)
>  		cpdma_ctlr_stop(ctlr);
>  
>  	for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++) {
> -		if (ctlr->channels[i])
> -			cpdma_chan_destroy(ctlr->channels[i]);
> +		cpdma_chan_destroy(ctlr->channels[i]);
>  	}

SInce this is now a single statement basic block, remove the
surrounding braces.

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

* [PATCH] net: ethernet: ti: remove redundant NULL check.
  2013-02-12 22:06 ` David Miller
@ 2013-02-12 22:52   ` Cyril Roelandt
  2013-02-13 18:41     ` David Miller
  2013-02-12 22:54   ` Cyril Roelandt
  1 sibling, 1 reply; 6+ messages in thread
From: Cyril Roelandt @ 2013-02-12 22:52 UTC (permalink / raw)
  To: davem
  Cc: linux-kernel, kernel-janitors, mugunthanvnm, zonque, hotforest,
	Julia.Lawall, netdev, Cyril Roelandt

cpdma_chan_destroy() on a NULL pointer is a no-op, so the NULL check in
cpdma_ctlr_destroy() can safely be removed.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
---
 drivers/net/ethernet/ti/davinci_cpdma.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index f862918..1c4b0aa 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -449,10 +449,8 @@ int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr)
 	if (ctlr->state != CPDMA_STATE_IDLE)
 		cpdma_ctlr_stop(ctlr);
 
-	for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++) {
-		if (ctlr->channels[i])
-			cpdma_chan_destroy(ctlr->channels[i]);
-	}
+	for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++)
+		cpdma_chan_destroy(ctlr->channels[i]);
 
 	cpdma_desc_pool_destroy(ctlr->pool);
 	spin_unlock_irqrestore(&ctlr->lock, flags);
-- 
1.7.10.4


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

* Re: [PATCH] net: ethernet: ti: remove redundant NULL check.
  2013-02-12 22:06 ` David Miller
  2013-02-12 22:52   ` Cyril Roelandt
@ 2013-02-12 22:54   ` Cyril Roelandt
  2013-02-12 23:48     ` David Miller
  1 sibling, 1 reply; 6+ messages in thread
From: Cyril Roelandt @ 2013-02-12 22:54 UTC (permalink / raw)
  To: David Miller
  Cc: linux-kernel, kernel-janitors, mugunthanvnm, zonque, hotforest,
	Julia.Lawall, netdev

On 02/12/2013 11:06 PM, David Miller wrote:
> From: Cyril Roelandt<tipecaml@gmail.com>
> Date: Tue, 12 Feb 2013 22:54:46 +0100
>
>> cpdma_chan_destroy() on a NULL pointer is a no-op, so the NULL check in
>> cpdma_ctlr_destroy() can safely be removed.
>>
>> Signed-off-by: Cyril Roelandt<tipecaml@gmail.com>
>   ...
>> @@ -450,8 +450,7 @@ int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr)
>>   		cpdma_ctlr_stop(ctlr);
>>
>>   	for (i = 0; i<  ARRAY_SIZE(ctlr->channels); i++) {
>> -		if (ctlr->channels[i])
>> -			cpdma_chan_destroy(ctlr->channels[i]);
>> +		cpdma_chan_destroy(ctlr->channels[i]);
>>   	}
>
> SInce this is now a single statement basic block, remove the
> surrounding braces.

Ok, I resent, though I forgot to add "v2".

Regards,
Cyril Roelandt.

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

* Re: [PATCH] net: ethernet: ti: remove redundant NULL check.
  2013-02-12 22:54   ` Cyril Roelandt
@ 2013-02-12 23:48     ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2013-02-12 23:48 UTC (permalink / raw)
  To: tipecaml
  Cc: linux-kernel, kernel-janitors, mugunthanvnm, zonque, hotforest,
	Julia.Lawall, netdev

From: Cyril Roelandt <tipecaml@gmail.com>
Date: Tue, 12 Feb 2013 23:54:41 +0100

> Ok, I resent, though I forgot to add "v2".

Don't worry about that.

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

* Re: [PATCH] net: ethernet: ti: remove redundant NULL check.
  2013-02-12 22:52   ` Cyril Roelandt
@ 2013-02-13 18:41     ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2013-02-13 18:41 UTC (permalink / raw)
  To: tipecaml
  Cc: linux-kernel, kernel-janitors, mugunthanvnm, zonque, hotforest,
	Julia.Lawall, netdev

From: Cyril Roelandt <tipecaml@gmail.com>
Date: Tue, 12 Feb 2013 23:52:30 +0100

> cpdma_chan_destroy() on a NULL pointer is a no-op, so the NULL check in
> cpdma_ctlr_destroy() can safely be removed.
> 
> Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>

Applied, thanks.

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

end of thread, other threads:[~2013-02-13 18:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-12 21:54 [PATCH] net: ethernet: ti: remove redundant NULL check Cyril Roelandt
2013-02-12 22:06 ` David Miller
2013-02-12 22:52   ` Cyril Roelandt
2013-02-13 18:41     ` David Miller
2013-02-12 22:54   ` Cyril Roelandt
2013-02-12 23:48     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).