Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220220151527.17216-13-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
bcf4ef28 671aa5a4

+4 -9
+4 -9
drivers/mtd/mtdcore.c
··· 742 742 debugfs_remove_recursive(mtd->dbg.dfs_dir); 743 743 744 744 /* Try to remove the NVMEM provider */ 745 - if (mtd->nvmem) 746 - nvmem_unregister(mtd->nvmem); 745 + nvmem_unregister(mtd->nvmem); 747 746 748 747 device_unregister(&mtd->dev); 749 748 ··· 920 921 return 0; 921 922 922 923 err: 923 - if (mtd->otp_user_nvmem) 924 - nvmem_unregister(mtd->otp_user_nvmem); 924 + nvmem_unregister(mtd->otp_user_nvmem); 925 925 return err; 926 926 } 927 927 ··· 1024 1026 memset(&master->reboot_notifier, 0, sizeof(master->reboot_notifier)); 1025 1027 } 1026 1028 1027 - if (master->otp_user_nvmem) 1028 - nvmem_unregister(master->otp_user_nvmem); 1029 - 1030 - if (master->otp_factory_nvmem) 1031 - nvmem_unregister(master->otp_factory_nvmem); 1029 + nvmem_unregister(master->otp_user_nvmem); 1030 + nvmem_unregister(master->otp_factory_nvmem); 1032 1031 1033 1032 err = del_mtd_partitions(master); 1034 1033 if (err)