Messages in this thread Patch in this message | | | From | cgel.zte@gmail ... | Subject | [PATCH] sparc64: Remove redundant NULL checks before kfree | Date | Mon, 6 Jun 2022 01:45:30 +0000 |
| |
From: Minghao Chi <chi.minghao@zte.com.cn>
Checking a pointer for NULL before calling kfree() on it is redundant, kfree() deals with NULL pointers just fine.
Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn> --- arch/sparc/kernel/cpumap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c index f07ea88a83af..1ae22b0d938c 100644 --- a/arch/sparc/kernel/cpumap.c +++ b/arch/sparc/kernel/cpumap.c @@ -352,10 +352,8 @@ static void _cpu_map_rebuild(void) { int i; - if (cpuinfo_tree) { - kfree(cpuinfo_tree); - cpuinfo_tree = NULL; - } + kfree(cpuinfo_tree); + cpuinfo_tree = NULL; cpuinfo_tree = build_cpuinfo_tree(); if (!cpuinfo_tree) -- 2.25.1
| |