Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffa3794f authored by Miquel Raynal's avatar Miquel Raynal Committed by Greg Kroah-Hartman
Browse files

mtd: rawnand: oxnas: Keep track of registered devices



commit 383fc3f613e7eac9f2e3c13b6f9fb8c1f39cb9d5 upstream.

All initialized and registered devices should be listed somewhere so
that we can unregister/free them in the _remove() path.

This patch is not a fix per-se but is needed to apply three other
fixes coming right after, explaining the Fixes/Cc: stable tags.

Fixes: 66859249 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-36-miquel.raynal@bootlin.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 419486ab
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ struct oxnas_nand_ctrl {
	void __iomem *io_base;
	void __iomem *io_base;
	struct clk *clk;
	struct clk *clk;
	struct nand_chip *chips[OXNAS_NAND_MAX_CHIPS];
	struct nand_chip *chips[OXNAS_NAND_MAX_CHIPS];
	unsigned int nchips;
};
};


static uint8_t oxnas_nand_read_byte(struct mtd_info *mtd)
static uint8_t oxnas_nand_read_byte(struct mtd_info *mtd)
@@ -86,7 +87,6 @@ static int oxnas_nand_probe(struct platform_device *pdev)
	struct nand_chip *chip;
	struct nand_chip *chip;
	struct mtd_info *mtd;
	struct mtd_info *mtd;
	struct resource *res;
	struct resource *res;
	int nchips = 0;
	int count = 0;
	int count = 0;
	int err = 0;
	int err = 0;


@@ -150,12 +150,12 @@ static int oxnas_nand_probe(struct platform_device *pdev)
		if (err)
		if (err)
			goto err_cleanup_nand;
			goto err_cleanup_nand;


		oxnas->chips[nchips] = chip;
		oxnas->chips[oxnas->nchips] = chip;
		++nchips;
		++oxnas->nchips;
	}
	}


	/* Exit if no chips found */
	/* Exit if no chips found */
	if (!nchips) {
	if (!oxnas->nchips) {
		err = -ENODEV;
		err = -ENODEV;
		goto err_clk_unprepare;
		goto err_clk_unprepare;
	}
	}