Skip to content

Commit

Permalink
mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister()…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
Link: https://lore.kernel.org/linux-mtd/[email protected]
  • Loading branch information
Uwe Kleine-König authored and miquelraynal committed Jun 9, 2022
1 parent 37e0024 commit 413948c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/mtd/nand/raw/tegra_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 413948c

Please sign in to comment.