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> Cc: 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 d40f9c8e2241..227474ca7743 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -1336,10 +1336,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/