* [PATCH V4] rcu: change function declaration to bool
@ 2015-05-11 16:12 Nicholas Mc Guire
2015-05-11 17:08 ` Josh Triplett
0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2015-05-11 16:12 UTC (permalink / raw)
To: Paul E. McKenney
Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
linux-kernel, Nicholas Mc Guire
rcu_cpu_has_callbacks() is declared int. The current declaration was introduced
in commit c0f4dfd4f90f (rcu: Make RCU_FAST_NO_HZ take advantage of numbered
callbacks). But it is actually returning bool and as the function description
states " * Return true if the specified CPU has any callback....", this probably
should be a bool as all (3) call-sites currently treat it as bool.
Type-checking coccinelle spatches are being used to locate type mismatches
between function signatures and return values in this case this produced:
./kernel/rcu/tree.c:3538 WARNING: return of wrong type
int != bool,
Patch was compile tested with x86_64_defconfig (implies CONFIG_TREE_RCU=y)
Patch is against 4.1-rc3 (localversion-next is -next-20150511) and fixes
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
V4: fix-up to include the origin of the issue being fixed as requeseted by
Steven Rostedt <rostedt@goodmis.org>.
kernel/rcu/tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index bcc5943..599550c 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3516,7 +3516,7 @@ static int rcu_pending(void)
* non-NULL, store an indication of whether all callbacks are lazy.
* (If there are no callbacks, all of them are deemed to be lazy.)
*/
-static int __maybe_unused rcu_cpu_has_callbacks(bool *all_lazy)
+static bool __maybe_unused rcu_cpu_has_callbacks(bool *all_lazy)
{
bool al = true;
bool hc = false;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH V4] rcu: change function declaration to bool
2015-05-11 16:12 [PATCH V4] rcu: change function declaration to bool Nicholas Mc Guire
@ 2015-05-11 17:08 ` Josh Triplett
0 siblings, 0 replies; 2+ messages in thread
From: Josh Triplett @ 2015-05-11 17:08 UTC (permalink / raw)
To: Nicholas Mc Guire
Cc: Paul E. McKenney, Steven Rostedt, Mathieu Desnoyers,
Lai Jiangshan, linux-kernel
On Mon, May 11, 2015 at 06:12:27PM +0200, Nicholas Mc Guire wrote:
> rcu_cpu_has_callbacks() is declared int. The current declaration was introduced
> in commit c0f4dfd4f90f (rcu: Make RCU_FAST_NO_HZ take advantage of numbered
> callbacks). But it is actually returning bool and as the function description
> states " * Return true if the specified CPU has any callback....", this probably
> should be a bool as all (3) call-sites currently treat it as bool.
>
> Type-checking coccinelle spatches are being used to locate type mismatches
> between function signatures and return values in this case this produced:
> ./kernel/rcu/tree.c:3538 WARNING: return of wrong type
> int != bool,
>
> Patch was compile tested with x86_64_defconfig (implies CONFIG_TREE_RCU=y)
>
> Patch is against 4.1-rc3 (localversion-next is -next-20150511) and fixes
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Seems like a reasonable addition.
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
> ---
>
> V4: fix-up to include the origin of the issue being fixed as requeseted by
> Steven Rostedt <rostedt@goodmis.org>.
>
> kernel/rcu/tree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index bcc5943..599550c 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3516,7 +3516,7 @@ static int rcu_pending(void)
> * non-NULL, store an indication of whether all callbacks are lazy.
> * (If there are no callbacks, all of them are deemed to be lazy.)
> */
> -static int __maybe_unused rcu_cpu_has_callbacks(bool *all_lazy)
> +static bool __maybe_unused rcu_cpu_has_callbacks(bool *all_lazy)
> {
> bool al = true;
> bool hc = false;
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-11 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 16:12 [PATCH V4] rcu: change function declaration to bool Nicholas Mc Guire
2015-05-11 17:08 ` Josh Triplett
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.