thunderbolt: Drop duplicate NULL checks around nvmem_unregister()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Sun, 20 Feb 2022 15:15:27 +0000 (15:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Feb 2022 17:00:30 +0000 (18:00 +0100)
Since nvmem_unregister() checks for NULL, no need to repeat in
the caller. Drop duplicate NULL checks.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.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-14-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/thunderbolt/nvm.c

index 3a53369..b3f3103 100644 (file)
@@ -154,10 +154,8 @@ int tb_nvm_add_non_active(struct tb_nvm *nvm, size_t size,
 void tb_nvm_free(struct tb_nvm *nvm)
 {
        if (nvm) {
-               if (nvm->non_active)
-                       nvmem_unregister(nvm->non_active);
-               if (nvm->active)
-                       nvmem_unregister(nvm->active);
+               nvmem_unregister(nvm->non_active);
+               nvmem_unregister(nvm->active);
                vfree(nvm->buf);
                ida_simple_remove(&nvm_ida, nvm->id);
        }