diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2023-12-03 11:25:28 +0100 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2023-12-28 08:22:47 +0100 |
commit | 407868deb2a344e9baa7909e1b13aec35c7217b2 (patch) | |
tree | e4a2514f115a507c267a17d8360a844e38e97369 /scripts | |
parent | kconfig: remove unreachable printf() (diff) | |
download | linux-407868deb2a344e9baa7909e1b13aec35c7217b2.tar.xz linux-407868deb2a344e9baa7909e1b13aec35c7217b2.zip |
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@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/kconfig/confdata.c | 3 | ||||
-rw-r--r-- | 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 @@ load: 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; } |