ring_buffer: fix warning
Subsystems (2)
PATCH 1/1 ring_buffer: fix warning
kernel/trace/ring_buffer.c: In function 'rb_tail_page_update':kernel/trace/ring_buffer.c:849: warning: value computed is not used kernel/trace/ring_buffer.c:850: warning: value computed is not used
Add a "(void)" to fix this warning.
---
kernel/trace/ring_buffer.c +2 -2
@@ -846,8 +846,8 @@ static int rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer,* not come in and change it. In which case, we * do not want to modify it. */ -local_cmpxchg (&next_page->write, old_write, val); -local_cmpxchg (&next_page->entries, old_entries, eval); + (void )local_cmpxchg (&next_page->write, old_write, val); + (void )local_cmpxchg (&next_page->entries, old_entries, eval);/* * No need to worry about races with clearing out the commit.
Quoted 14 lines · Lai Jiangshan
kernel/trace/ring_buffer.c: In function 'rb_tail_page_update':kernel/trace/ring_buffer.c:849: warning: value computed is not usedkernel/trace/ring_buffer.c:850: warning: value computed is not usedAdd a "(void)" to fix this warning.
Signed-off-by Lai Jiangshan <[email protected]>---
kernel/trace/ring_buffer.c +0
-0
kernel/trace/ring_buffer.c static int rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer, · line 853
Quoted 10 lines
kernel/trace/ring_buffer.c +2
-2@@ -846,8 +846,8 @@ static int rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer,* not come in and change it. In which case, we * do not want to modify it. */ -local_cmpxchg (&next_page->write, old_write, val); -local_cmpxchg (&next_page->entries, old_entries, eval); + (void )local_cmpxchg (&next_page->write, old_write, val); + (void )local_cmpxchg (&next_page->entries, old_entries, eval);/* * No need to worry about races with clearing out the commit.
Looks good. Indeed the rest of the path remains the same, whether the interrupts have already won the race or not.
Quoted 23 lines · Frederic Weisbecker
Quoted 22 lines · Lai Jiangshan
kernel/trace/ring_buffer.c: In function 'rb_tail_page_update':kernel/trace/ring_buffer.c:849: warning: value computed is not usedkernel/trace/ring_buffer.c:850: warning: value computed is not usedAdd a "(void)" to fix this warning.
Signed-off-by Lai Jiangshan <[email protected]>---
kernel/trace/ring_buffer.c +2
-2@@ -846,8 +846,8 @@ static int rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer,* not come in and change it. In which case, we * do not want to modify it. */ -local_cmpxchg (&next_page->write, old_write, val); -local_cmpxchg (&next_page->entries, old_entries, eval); + (void )local_cmpxchg (&next_page->write, old_write, val); + (void )local_cmpxchg (&next_page->entries, old_entries, eval);
Quoted 6 lines
kernel/trace/ring_buffer.c static int rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer, · line 853
Quoted 2 lines
kernel/trace/ring_buffer.c +0
-0/* * No need to worry about races with clearing out the commit. Looks good. Indeed the rest of the path remains the same, whether the interrupts have already won the race or not.
Yes, but it needs a comment:
/*
* We add (void) to let the compiler know that we do not care
* about the return value of these functions. We use the
* cmpxchg to only update if an interrupt did not already
* do it for us. If the cmpxchg fails, we don't care. */
Then you can have my:
-- Steve
Quoted 4 lines
Reviewed-by Frederic Weisbecker <[email protected]>
Re: [PATCH -tip] ring_buffer: fix warning (V2)
In reply to Lai Jiangshankernel/trace/ring_buffer.c: In function 'rb_tail_page_update':kernel/trace/ring_buffer.c:849: warning: value computed is not used kernel/trace/ring_buffer.c:850: warning: value computed is not used
Add "(void)"s to fix this warning.
Changed from V1:
Add a comment(which is written by Steven) for it.
---
kernel/trace/ring_buffer.c +7 -2
@@ -845,9 +845,14 @@ static int rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer,* This will only succeed if an interrupt did * not come in and change it. In which case, we * do not want to modify it. +* +* We add (void) to let the compiler know that we do not care +* about the return value of these functions. We use the +* cmpxchg to only update if an interrupt did not already +* do it for us. If the cmpxchg fails, we don't care. */ -local_cmpxchg (&next_page->write, old_write, val); -local_cmpxchg (&next_page->entries, old_entries, eval); + (void )local_cmpxchg (&next_page->write, old_write, val); + (void )local_cmpxchg (&next_page->entries, old_entries, eval);/* * No need to worry about races with clearing out the commit.
PATCH v2 1/1 ring_buffer: fix warning
Sorry for missing Reviewed-by and Acked-by, so I resend it.
Subject: [PATCH -tip V2] ring_buffer: fix warning
kernel/trace/ring_buffer.c: In function 'rb_tail_page_update':kernel/trace/ring_buffer.c:849: warning: value computed is not used kernel/trace/ring_buffer.c:850: warning: value computed is not used
Add "(void)"s to fix this warning.
Changed from V1:
Add a comment(which is written by Steven) for it.
---
kernel/trace/ring_buffer.c +7 -2
@@ -845,9 +845,14 @@ static int rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer,* This will only succeed if an interrupt did * not come in and change it. In which case, we * do not want to modify it. +* +* We add (void) to let the compiler know that we do not care +* about the return value of these functions. We use the +* cmpxchg to only update if an interrupt did not already +* do it for us. If the cmpxchg fails, we don't care. */ -local_cmpxchg (&next_page->write, old_write, val); -local_cmpxchg (&next_page->entries, old_entries, eval); + (void )local_cmpxchg (&next_page->write, old_write, val); + (void )local_cmpxchg (&next_page->entries, old_entries, eval);/* * No need to worry about races with clearing out the commit.
Frederic Weisbecker
AppliedQuoted 8 lines · Lai Jiangshan
Sorry for missing Reviewed-by and Acked-by, so I resend it.
Subject: [PATCH -tip V2]
ring_buffer: fix warning
kernel/trace/ring_buffer.c: In function 'rb_tail_page_update':kernel/trace/ring_buffer.c:849: warning: value computed is not usedkernel/trace/ring_buffer.c:850: warning: value computed is not used
Quoted 8 lines
Add "(void)"s to fix this warning.
Changed from V1:
Add a comment(which is written by Steven) for it.Signed-off-by Lai Jiangshan <[email protected]>Reviewed-by Frederic Weisbecker <[email protected]>Acked-by Steven Rostedt <[email protected]>
Queued for .32, thanks!
Quoted 23 lines
---
kernel/trace/ring_buffer.c +7
-2@@ -845,9 +845,14 @@ static int rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer,* This will only succeed if an interrupt did * not come in and change it. In which case, we * do not want to modify it. +* +* We add (void) to let the compiler know that we do not care +* about the return value of these functions. We use the +* cmpxchg to only update if an interrupt did not already +* do it for us. If the cmpxchg fails, we don't care. */ -local_cmpxchg (&next_page->write, old_write, val); -local_cmpxchg (&next_page->entries, old_entries, eval); + (void )local_cmpxchg (&next_page->write, old_write, val); + (void )local_cmpxchg (&next_page->entries, old_entries, eval);/* * No need to worry about races with clearing out the commit.