Skip to content

Commit 0057568

Browse files
Uwe Kleine-Königmiquelraynal
authored andcommitted
mtd: spear_smi: Don't skip cleanup after mtd_device_unregister() failed
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-7-u.kleine-koenig@pengutronix.de
1 parent 0aaa0b5 commit 0057568

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/mtd/devices/spear_smi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ static int spear_smi_remove(struct platform_device *pdev)
10451045
{
10461046
struct spear_smi *dev;
10471047
struct spear_snor_flash *flash;
1048-
int ret, i;
1048+
int i;
10491049

10501050
dev = platform_get_drvdata(pdev);
10511051
if (!dev) {
@@ -1060,9 +1060,7 @@ static int spear_smi_remove(struct platform_device *pdev)
10601060
continue;
10611061

10621062
/* clean up mtd stuff */
1063-
ret = mtd_device_unregister(&flash->mtd);
1064-
if (ret)
1065-
dev_err(&pdev->dev, "error removing mtd\n");
1063+
WARN_ON(mtd_device_unregister(&flash->mtd));
10661064
}
10671065

10681066
clk_disable_unprepare(dev->clk);

0 commit comments

Comments
 (0)