Commit bcf4ef28 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

mtd: core: Drop duplicate NULL checks around nvmem_unregister()

Since nvmem_unregister() checks for NULL, no need to repeat in
the caller. Drop duplicate NULL checks.
Acked-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220220151527.17216-13-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 671aa5a4
...@@ -742,7 +742,6 @@ int del_mtd_device(struct mtd_info *mtd) ...@@ -742,7 +742,6 @@ int del_mtd_device(struct mtd_info *mtd)
debugfs_remove_recursive(mtd->dbg.dfs_dir); debugfs_remove_recursive(mtd->dbg.dfs_dir);
/* Try to remove the NVMEM provider */ /* Try to remove the NVMEM provider */
if (mtd->nvmem)
nvmem_unregister(mtd->nvmem); nvmem_unregister(mtd->nvmem);
device_unregister(&mtd->dev); device_unregister(&mtd->dev);
...@@ -921,7 +920,6 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) ...@@ -921,7 +920,6 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)
return 0; return 0;
err: err:
if (mtd->otp_user_nvmem)
nvmem_unregister(mtd->otp_user_nvmem); nvmem_unregister(mtd->otp_user_nvmem);
return err; return err;
} }
...@@ -1026,10 +1024,7 @@ int mtd_device_unregister(struct mtd_info *master) ...@@ -1026,10 +1024,7 @@ int mtd_device_unregister(struct mtd_info *master)
memset(&master->reboot_notifier, 0, sizeof(master->reboot_notifier)); memset(&master->reboot_notifier, 0, sizeof(master->reboot_notifier));
} }
if (master->otp_user_nvmem)
nvmem_unregister(master->otp_user_nvmem); nvmem_unregister(master->otp_user_nvmem);
if (master->otp_factory_nvmem)
nvmem_unregister(master->otp_factory_nvmem); nvmem_unregister(master->otp_factory_nvmem);
err = del_mtd_partitions(master); err = del_mtd_partitions(master);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment