From: Miquel Raynal Date: Tue, 19 May 2020 12:59:43 +0000 (+0200) Subject: mtd: rawnand: denali: Delete items from the list in the _remove() path X-Git-Tag: v5.8-rc1~68^2~5^2~85 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6ac64a17554ff98b5419af29ed139860a910ad0b;p=users%2Fjedix%2Flinux-maple.git mtd: rawnand: denali: Delete items from the list in the _remove() path 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 Acked-by: Masahiro Yamada Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-11-miquel.raynal@bootlin.com --- 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); }