Skip to contentSkip to conversation

kvfree_rcu(): fix ifnullfree.cocci warnings

PATCH In review Julia Lawall 3 participants 3 messages Sep 27, 2020 – Sep 28, 2020 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvfree_rcu(): fix ifnullfree.cocci warnings

From: kernel test robot <[email protected]>

NULL check before kfree is not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes e9bed2a1239b ("kvfree_rcu(): Switch to kmalloc() and kfree() for allocations")

---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
head:   1a8eee1cc5b0e59c17f5d94c5871e6c70c4a43a1
commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/18] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations

:::::: branch date: 4 hours ago
:::::: commit date: 15 hours ago

 tree.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/rcu/tree.c +1 -2
@@ -3165,8 +3165,7 @@ static void kfree_rcu_work(struct work_s
 				bkvhead[i] = NULL;
 			krc_this_cpu_unlock(krcp, flags);
 
-			if (bkvhead[i])
-				kfree(bkvhead[i]);
+			kfree(bkvhead[i]);
 
 			cond_resched_tasks_rcu_qs();
 		}
Acked-by on v1 1/1
#1 lore raw
Quoted 23 lines · Julia Lawall

From: kernel test robot <[email protected]>

NULL check before kfree is not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes e9bed2a1239b ("kvfree_rcu(): Switch to kmalloc() and kfree() for allocations")

---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
head:   1a8eee1cc5b0e59c17f5d94c5871e6c70c4a43a1
commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/18] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations

:::::: branch date: 4 hours ago
:::::: commit date: 15 hours ago

 tree.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

kernel/rcu/tree.c static void kfree_rcu_work(struct work_s · line 3169

Quoted 7 lines
kernel/rcu/tree.c +1 -2
@@ -3165,8 +3165,7 @@ static void kfree_rcu_work(struct work_s
 				bkvhead[i] = NULL;
 			krc_this_cpu_unlock(krcp, flags);
 
-			if (bkvhead[i])
-				kfree(bkvhead[i]);
+			kfree(bkvhead[i]);
 

thanks,

- Joel

Quoted 2 lines
kernel/rcu/tree.c +0 -0
 			cond_resched_tasks_rcu_qs();
 		}
maintainer
#2 lore raw
Quoted 27 lines · Joel Fernandes
Quoted 26 lines · Julia Lawall

From: kernel test robot <[email protected]>

NULL check before kfree is not needed.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes e9bed2a1239b ("kvfree_rcu(): Switch to kmalloc() and kfree() for allocations")

---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git urezki-pcount.2020.09.26a
head:   1a8eee1cc5b0e59c17f5d94c5871e6c70c4a43a1
commit: e9bed2a1239b017d78cec5de66adce0560f6d077 [17/18] kvfree_rcu(): Switch to kmalloc() and kfree() for allocations

:::::: branch date: 4 hours ago
:::::: commit date: 15 hours ago

 tree.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/rcu/tree.c +0 -0
@@ -3165,8 +3165,7 @@ static void kfree_rcu_work(struct work_s
 				bkvhead[i] = NULL;
 			krc_this_cpu_unlock(krcp, flags);
 
Quoted 6 lines

kernel/rcu/tree.c static void kfree_rcu_work(struct work_s · line 3169

Quoted 4 lines
kernel/rcu/tree.c +1 -2
-			if (bkvhead[i])
-				kfree(bkvhead[i]);
+			kfree(bkvhead[i]);
 

Applied and pushed, thank you both!

Thanx, Paul

Quoted 6 lines

thanks,

- Joel

Quoted 2 lines
kernel/rcu/tree.c +0 -0
 			cond_resched_tasks_rcu_qs();
 		}