[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231203102528.1913822-6-masahiroy@kernel.org>
Date: Sun, 3 Dec 2023 19:25:28 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: Masahiro Yamada <masahiroy@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH 6/6] kconfig: remove redundant NULL pointer check before free()
Passing NULL to free() is allowed and is a no-op.
Remove redundant NULL pointer checks.
Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---
scripts/kconfig/confdata.c | 3 +--
scripts/kconfig/util.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index bd14aae1db58..f1197e672431 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -432,8 +432,7 @@ int conf_read_simple(const char *name, int def)
case S_INT:
case S_HEX:
case S_STRING:
- if (sym->def[def].val)
- free(sym->def[def].val);
+ free(sym->def[def].val);
/* fall through */
default:
sym->def[def].val = NULL;
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index b78f114ad48c..92e5b2b9761d 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -42,8 +42,7 @@ struct gstr str_new(void)
/* Free storage for growable string */
void str_free(struct gstr *gs)
{
- if (gs->s)
- free(gs->s);
+ free(gs->s);
gs->s = NULL;
gs->len = 0;
}
--
2.40.1
Powered by blists - more mailing lists