[PATCH 30/47] kernel: Use RCU_INIT_POINTER(x, NULL) in events/core.c
From: Monam Agarwal
Date: Sun Mar 23 2014 - 14:50:20 EST
This patch replaces rcu_assign_pointer(x, NULL) with RCU_INIT_POINTER(x, NULL)
The rcu_assign_pointer() ensures that the initialization of a structure
is carried out before storing a pointer to that structure.
And in the case of the NULL pointer, there is no structure to initialize.
So, rcu_assign_pointer(p, NULL) can be safely converted to RCU_INIT_POINTER(p, NULL)
Signed-off-by: Monam Agarwal <monamagarwal123@xxxxxxxxx>
---
kernel/events/core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index fa0b2d4..8c22758 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3247,7 +3247,7 @@ static void free_event(struct perf_event *event)
mutex_lock(&event->mmap_mutex);
rb = event->rb;
if (rb) {
- rcu_assign_pointer(event->rb, NULL);
+ RCU_INIT_POINTER(event->rb, NULL);
ring_buffer_detach(event, rb);
ring_buffer_put(rb); /* could be last */
}
@@ -3938,7 +3938,7 @@ static void perf_mmap_close(struct vm_area_struct *vma)
return;
/* Detach current event from the buffer. */
- rcu_assign_pointer(event->rb, NULL);
+ RCU_INIT_POINTER(event->rb, NULL);
ring_buffer_detach(event, rb);
mutex_unlock(&event->mmap_mutex);
@@ -3977,7 +3977,7 @@ again:
* iterating the wrong list.
*/
if (event->rb == rb) {
- rcu_assign_pointer(event->rb, NULL);
+ RCU_INIT_POINTER(event->rb, NULL);
ring_buffer_detach(event, rb);
ring_buffer_put(rb); /* can't be last, we still have one */
}
@@ -5690,7 +5690,7 @@ static void swevent_hlist_release(struct swevent_htable *swhash)
if (!hlist)
return;
- rcu_assign_pointer(swhash->swevent_hlist, NULL);
+ RCU_INIT_POINTER(swhash->swevent_hlist, NULL);
kfree_rcu(hlist, rcu_head);
}
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/