[PATCH v2 10/62] mtd: rawnand: denali: Delete items from the list in the _remove() path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Denali driver keeps track of devices with a list. Delete items of this
list as long as they are not in use anymore.

Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
Acked-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
---
 drivers/mtd/nand/raw/denali.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
index 7a76b761dd0b..6ac125b9e927 100644
--- a/drivers/mtd/nand/raw/denali.c
+++ b/drivers/mtd/nand/raw/denali.c
@@ -1359,10 +1359,12 @@ EXPORT_SYMBOL(denali_init);
 
 void denali_remove(struct denali_controller *denali)
 {
-	struct denali_chip *dchip;
+	struct denali_chip *dchip, *tmp;
 
-	list_for_each_entry(dchip, &denali->chips, node)
+	list_for_each_entry_safe(dchip, tmp, &denali->chips, node) {
 		nand_release(&dchip->chip);
+		list_del(&dchip->node);
+	}
 
 	denali_disable_irq(denali);
 }
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux