diff options
author | Masahiro Yamada | 2023-12-03 19:25:28 +0900 |
---|---|---|
committer | Masahiro Yamada | 2023-12-28 16:22:47 +0900 |
commit | 407868deb2a344e9baa7909e1b13aec35c7217b2 (patch) | |
tree | e4a2514f115a507c267a17d8360a844e38e97369 | |
parent | 9ad86d747c46f2bdc097c908481647fcdda1d035 (diff) |
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>
-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; } |