[tip: locking/futex] futex: Remove unnecessary NULL check before kvfree()
From: tip-bot2 for Vasileios Almpanis
Date: Sun Jul 05 2026 - 08:54:53 EST
The following commit has been merged into the locking/futex branch of tip:
Commit-ID: 4903ab0c83f033424879ba7435668f9ebe14f641
Gitweb: https://git.kernel.org/tip/4903ab0c83f033424879ba7435668f9ebe14f641
Author: Vasileios Almpanis <vasilisalmpanis@xxxxxxxxx>
AuthorDate: Tue, 30 Jun 2026 15:35:21 +02:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Sun, 05 Jul 2026 14:50:19 +02:00
futex: Remove unnecessary NULL check before kvfree()
The NULL check before kvfree() is unnecessary and triggers a Coccinelle
warning, since kvfree() handles NULL arguments internally.
Reported by ifnullfree.cocci Coccinelle semantic patch script.
Signed-off-by: Vasileios Almpanis <vasilisalmpanis@xxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Reviewed-by: André Almeida <andrealmeid@xxxxxxxxxx>
Link: https://patch.msgid.link/20260630133530.2577832-1-vasilisalmpanis@xxxxxxxxx
---
kernel/futex/core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 179b26e..233b926 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1746,8 +1746,7 @@ void futex_hash_free(struct mm_struct *mm)
free_percpu(mm->futex.phash.ref);
kvfree(mm->futex.phash.hash_new);
fph = rcu_dereference_raw(mm->futex.phash.hash);
- if (fph)
- kvfree(fph);
+ kvfree(fph);
}
static bool futex_pivot_pending(struct mm_struct *mm)