Skip to contentSkip to conversation

net: ethernet: ti: remove redundant NULL check.

PATCH In review Cyril Roelandt 2 participants 6 messages Feb 12, 2013 – Feb 13, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: ti: remove redundant NULL check.

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

---
 drivers/net/ethernet/ti/davinci_cpdma.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_cpdma.c +1 -2
index f862918..aba787b 100644
@@ -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);
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw

From: Cyril Roelandt <[email protected]>
Date: Tue, 12 Feb 2013 22:54:46 +0100

Quoted 4 lines

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

...

drivers/net/ethernet/ti/davinci_cpdma.c int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr) · line 454

Quoted 8 lines
drivers/net/ethernet/ti/davinci_cpdma.c +1 -2
@@ -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.

#2 lore raw

PATCH 1/1 net: ethernet: ti: remove redundant NULL check.

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

---
 drivers/net/ethernet/ti/davinci_cpdma.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/ti/davinci_cpdma.c +2 -4
index f862918..1c4b0aa 100644
@@ -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);
Signature · 1 line
1.7.10.4
#4 lore raw
In reply to David Miller
Quoted 11 lines · David Miller

From: Cyril Roelandt<[email protected]>
Date: Tue, 12 Feb 2013 22:54:46 +0100

Quoted 4 lines

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

...

Quoted 3 lines
drivers/net/ethernet/ti/davinci_cpdma.c +0 -0
@@ -450,8 +450,7 @@ int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr)
  		cpdma_ctlr_stop(ctlr);
 
Quoted 8 lines

drivers/net/ethernet/ti/davinci_cpdma.c int cpdma_ctlr_destroy(struct cpdma_ctlr *ctlr) · line 454

Quoted 5 lines
drivers/net/ethernet/ti/davinci_cpdma.c +1 -2
  	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.

maintainer
#5 lore raw

From: Cyril Roelandt <[email protected]>
Date: Tue, 12 Feb 2013 23:54:41 +0100

Quoted 1 line

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

Don't worry about that.