| From 074c9ef4c7d25bd1776b0a9c41edb0cb1fdb038b Mon Sep 17 00:00:00 2001 |
| From: Miquel Raynal <miquel.raynal@bootlin.com> |
| Date: Tue, 19 May 2020 15:00:11 +0200 |
| Subject: [PATCH] mtd: rawnand: oxnas: Release all devices in the _remove() |
| path |
| |
| commit 0a5f45e57e35d0840bedb816974ce2e63406cd8b upstream. |
| |
| oxnans_nand_remove() should release all MTD devices and clean all NAND |
| devices, not only the first one registered. |
| |
| Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support") |
| Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> |
| Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-39-miquel.raynal@bootlin.com |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c |
| index 6ae71e2a0ed5..504c4504300c 100644 |
| --- a/drivers/mtd/nand/raw/oxnas_nand.c |
| +++ b/drivers/mtd/nand/raw/oxnas_nand.c |
| @@ -177,9 +177,13 @@ static int oxnas_nand_probe(struct platform_device *pdev) |
| static int oxnas_nand_remove(struct platform_device *pdev) |
| { |
| struct oxnas_nand_ctrl *oxnas = platform_get_drvdata(pdev); |
| + struct nand_chip *chip; |
| + int i; |
| |
| - if (oxnas->chips[0]) |
| - nand_release(oxnas->chips[0]); |
| + for (i = 0; i < oxnas->nchips; i++) { |
| + chip = oxnas->chips[i]; |
| + nand_release(chip); |
| + } |
| |
| clk_disable_unprepare(oxnas->clk); |
| |
| -- |
| 2.27.0 |
| |