rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 03/10] cpu: Remove Comparison to bool
       [not found] ` <20200327212358.5752-1-jbi.octave@gmail.com>
@ 2020-03-27 21:23   ` Jules Irenge
  2020-03-28 11:29     ` Thomas Gleixner
  2020-03-27 21:23   ` [PATCH 06/10] rcu: Replace assigned pointer ret value by corresponding boolean value Jules Irenge
  1 sibling, 1 reply; 4+ messages in thread
From: Jules Irenge @ 2020-03-27 21:23 UTC (permalink / raw)
  To: julia.lawall
  Cc: boqun.feng, Jules Irenge, Paul E. McKenney, Josh Triplett,
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes,
	Thomas Gleixner, Peter Zijlstra, Josh Poimboeuf, Jiri Kosina,
	Ingo Molnar, Vitaly Kuznetsov, Qian Cai, Arnd Bergmann,
	Tyler Hicks, open list, open list:READ-COPY UPDATE (RCU)

From: Jules Irenge <jbi.octave@example.com>

Coccinelle reports a warning inside __cpuhp_state_add_instance_cpuslocked

WARNING: Comparison to bool

To fix this, the comparison to bool is removed
This not only fixes the issue but also removes the unnecessary comparison.

Remove comparison to bool

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/cpu.c      | 2 +-
 kernel/rcu/tree.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 9c706af713fb..97f8b79ba5f5 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1682,7 +1682,7 @@ int __cpuhp_state_add_instance_cpuslocked(enum cpuhp_state state,
 	lockdep_assert_cpus_held();
 
 	sp = cpuhp_get_step(state);
-	if (sp->multi_instance == false)
+	if (!sp->multi_instance)
 		return -EINVAL;
 
 	mutex_lock(&cpuhp_state_mutex);
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index d91c9156fab2..c2ffea31eae8 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -100,7 +100,7 @@ static struct rcu_state rcu_state = {
 static bool dump_tree;
 module_param(dump_tree, bool, 0444);
 /* By default, use RCU_SOFTIRQ instead of rcuc kthreads. */
-static bool use_softirq = 1;
+static bool use_softirq = true;
 module_param(use_softirq, bool, 0444);
 /* Control rcu_node-tree auto-balancing at boot time. */
 static bool rcu_fanout_exact;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 06/10] rcu: Replace assigned pointer ret value by corresponding boolean value
       [not found] ` <20200327212358.5752-1-jbi.octave@gmail.com>
  2020-03-27 21:23   ` [PATCH 03/10] cpu: Remove Comparison to bool Jules Irenge
@ 2020-03-27 21:23   ` Jules Irenge
  2020-03-30 21:12     ` Paul E. McKenney
  1 sibling, 1 reply; 4+ messages in thread
From: Jules Irenge @ 2020-03-27 21:23 UTC (permalink / raw)
  To: julia.lawall
  Cc: boqun.feng, Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes,
	open list:READ-COPY UPDATE (RCU),
	open list

Coccinelle reports warnings at rcu_read_lock_held_common()

WARNING: Assignment of 0/1 to bool variable

To fix this,
the assigned  pointer ret values are replaced by corresponding boolean value.
Given that ret is a pointer of bool type

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 kernel/rcu/update.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index 6c4b862f57d6..24fb64fd1a1a 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -98,15 +98,15 @@ module_param(rcu_normal_after_boot, int, 0);
 static bool rcu_read_lock_held_common(bool *ret)
 {
 	if (!debug_lockdep_rcu_enabled()) {
-		*ret = 1;
+		*ret = true;
 		return true;
 	}
 	if (!rcu_is_watching()) {
-		*ret = 0;
+		*ret = false;
 		return true;
 	}
 	if (!rcu_lockdep_current_cpu_online()) {
-		*ret = 0;
+		*ret = false;
 		return true;
 	}
 	return false;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 03/10] cpu: Remove Comparison to bool
  2020-03-27 21:23   ` [PATCH 03/10] cpu: Remove Comparison to bool Jules Irenge
@ 2020-03-28 11:29     ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2020-03-28 11:29 UTC (permalink / raw)
  To: Jules Irenge, julia.lawall
  Cc: boqun.feng, Jules Irenge, Paul E. McKenney, Josh Triplett,
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes,
	Peter Zijlstra, Josh Poimboeuf, Jiri Kosina, Ingo Molnar,
	Vitaly Kuznetsov, Qian Cai, Arnd Bergmann, Tyler Hicks,
	open list, open list:READ-COPY UPDATE (RCU)

Jules Irenge <jbi.octave@gmail.com> writes:
> ---
>  kernel/cpu.c      | 2 +-
>  kernel/rcu/tree.c | 2 +-

How is rcu/tree.c related to 'cpu:' ?

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 06/10] rcu: Replace assigned pointer ret value by corresponding boolean value
  2020-03-27 21:23   ` [PATCH 06/10] rcu: Replace assigned pointer ret value by corresponding boolean value Jules Irenge
@ 2020-03-30 21:12     ` Paul E. McKenney
  0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2020-03-30 21:12 UTC (permalink / raw)
  To: Jules Irenge
  Cc: julia.lawall, boqun.feng, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes,
	open list:READ-COPY UPDATE (RCU),
	open list

On Fri, Mar 27, 2020 at 09:23:53PM +0000, Jules Irenge wrote:
> Coccinelle reports warnings at rcu_read_lock_held_common()
> 
> WARNING: Assignment of 0/1 to bool variable
> 
> To fix this,
> the assigned  pointer ret values are replaced by corresponding boolean value.
> Given that ret is a pointer of bool type
> 
> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>

Queued for further review and testing, thank you!

							Thanx, Paul

> ---
>  kernel/rcu/update.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
> index 6c4b862f57d6..24fb64fd1a1a 100644
> --- a/kernel/rcu/update.c
> +++ b/kernel/rcu/update.c
> @@ -98,15 +98,15 @@ module_param(rcu_normal_after_boot, int, 0);
>  static bool rcu_read_lock_held_common(bool *ret)
>  {
>  	if (!debug_lockdep_rcu_enabled()) {
> -		*ret = 1;
> +		*ret = true;
>  		return true;
>  	}
>  	if (!rcu_is_watching()) {
> -		*ret = 0;
> +		*ret = false;
>  		return true;
>  	}
>  	if (!rcu_lockdep_current_cpu_online()) {
> -		*ret = 0;
> +		*ret = false;
>  		return true;
>  	}
>  	return false;
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-30 21:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <0/10>
     [not found] ` <20200327212358.5752-1-jbi.octave@gmail.com>
2020-03-27 21:23   ` [PATCH 03/10] cpu: Remove Comparison to bool Jules Irenge
2020-03-28 11:29     ` Thomas Gleixner
2020-03-27 21:23   ` [PATCH 06/10] rcu: Replace assigned pointer ret value by corresponding boolean value Jules Irenge
2020-03-30 21:12     ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).