2022-01-04 13:38:41

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 5/5] thunderbolt: Drop duplicate NULL checks around nvmem_unregister()

Since nvmem_unregister() checks for NULL, no need to repeat in
the caller. Drop duplicate NULL checks.

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/thunderbolt/nvm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/thunderbolt/nvm.c b/drivers/thunderbolt/nvm.c
index 3a5336913cca..b3f310389378 100644
--- a/drivers/thunderbolt/nvm.c
+++ b/drivers/thunderbolt/nvm.c
@@ -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);
}
--
2.34.1



2022-01-04 15:27:58

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH v1 5/5] thunderbolt: Drop duplicate NULL checks around nvmem_unregister()

On Tue, Jan 04, 2022 at 03:38:43PM +0200, Andy Shevchenko wrote:
> Since nvmem_unregister() checks for NULL, no need to repeat in
> the caller. Drop duplicate NULL checks.
>
> Signed-off-by: Andy Shevchenko <[email protected]>

Acked-by: Mika Westerberg <[email protected]>