mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister() failed
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 3 Jun 2022 21:07:54 +0000 (23:07 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 9 Jun 2022 13:06:23 +0000 (15:06 +0200)
If mtd_device_unregister() fails (which it doesn't when used correctly),
the resources bound by the nand chip should be freed anyhow as returning
an error value doesn't prevent the device getting unbound.

Instead use WARN_ON on the return value similar to how other drivers do
it.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220603210758.148493-11-u.kleine-koenig@pengutronix.de
drivers/mtd/nand/raw/tegra_nand.c

index b36e5260ae274a165e8b30d08d9bf270d15133ea..e12f9f580a15f0a3d8415d138ee2f3bd90663a72 100644 (file)
@@ -1223,11 +1223,8 @@ static int tegra_nand_remove(struct platform_device *pdev)
        struct tegra_nand_controller *ctrl = platform_get_drvdata(pdev);
        struct nand_chip *chip = ctrl->chip;
        struct mtd_info *mtd = nand_to_mtd(chip);
-       int ret;
 
-       ret = mtd_device_unregister(mtd);
-       if (ret)
-               return ret;
+       WARN_ON(mtd_device_unregister(mtd));
 
        nand_cleanup(chip);