Skip to contentSkip to conversation

dma: of: Remove unnecessary list_empty check

PATCH In review Lars-Peter Clausen 2 participants 2 messages Mar 25, 2013 – Mar 29, 2013 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma: of: Remove unnecessary list_empty check

list_for_each_entry is able to handle empty lists just fine, there is no need to make sure that the list is non empty.

---
 drivers/dma/of-dma.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/dma/of-dma.c +0 -5
index 7cad4d7..6679020 100644
@@ -36,11 +36,6 @@ static struct of_dma *of_dma_get_controller(struct of_phandle_args *dma_spec)
 
 	spin_lock(&of_dma_lock);
 
-	if (list_empty(&of_dma_list)) {
-		spin_unlock(&of_dma_lock);
-		return NULL;
-	}
-
 	list_for_each_entry(ofdma, &of_dma_list, of_dma_controllers)
 		if ((ofdma->of_node == dma_spec->np) &&
 		    (ofdma->of_dma_nbcells == dma_spec->args_count)) {
Signature · 1 line
1.8.0
#1 lore raw
Quoted 4 lines · Lars-Peter Clausen

list_for_each_entry is able to handle empty lists just fine, there is no need to make sure that the list is non empty.

Applied thanks

Quoted 23 lines
---
 drivers/dma/of-dma.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/dma/of-dma.c +0 -5
index 7cad4d7..6679020 100644
@@ -36,11 +36,6 @@ static struct of_dma *of_dma_get_controller(struct of_phandle_args *dma_spec)
 
 	spin_lock(&of_dma_lock);
 
-	if (list_empty(&of_dma_list)) {
-		spin_unlock(&of_dma_lock);
-		return NULL;
-	}
-
 	list_for_each_entry(ofdma, &of_dma_list, of_dma_controllers)
 		if ((ofdma->of_node == dma_spec->np) &&
 		    (ofdma->of_dma_nbcells == dma_spec->args_count)) {
Signature · 1 line
1.8.0