mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
mtd: physmap: 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-14-u.kleine-koenig@pengutronix.de
This commit is contained in:
parent
43adab7fd4
commit
bb8236541f
@ -66,7 +66,7 @@ static int physmap_flash_remove(struct platform_device *dev)
|
|||||||
{
|
{
|
||||||
struct physmap_flash_info *info;
|
struct physmap_flash_info *info;
|
||||||
struct physmap_flash_data *physmap_data;
|
struct physmap_flash_data *physmap_data;
|
||||||
int i, err = 0;
|
int i;
|
||||||
|
|
||||||
info = platform_get_drvdata(dev);
|
info = platform_get_drvdata(dev);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
@ -75,9 +75,7 @@ static int physmap_flash_remove(struct platform_device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info->cmtd) {
|
if (info->cmtd) {
|
||||||
err = mtd_device_unregister(info->cmtd);
|
WARN_ON(mtd_device_unregister(info->cmtd));
|
||||||
if (err)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (info->cmtd != info->mtds[0])
|
if (info->cmtd != info->mtds[0])
|
||||||
mtd_concat_destroy(info->cmtd);
|
mtd_concat_destroy(info->cmtd);
|
||||||
@ -92,10 +90,9 @@ static int physmap_flash_remove(struct platform_device *dev)
|
|||||||
if (physmap_data && physmap_data->exit)
|
if (physmap_data && physmap_data->exit)
|
||||||
physmap_data->exit(dev);
|
physmap_data->exit(dev);
|
||||||
|
|
||||||
out:
|
|
||||||
pm_runtime_put(&dev->dev);
|
pm_runtime_put(&dev->dev);
|
||||||
pm_runtime_disable(&dev->dev);
|
pm_runtime_disable(&dev->dev);
|
||||||
return err;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void physmap_set_vpp(struct map_info *map, int state)
|
static void physmap_set_vpp(struct map_info *map, int state)
|
||||||
|
Loading…
Reference in New Issue
Block a user