2020-07-06 13:40:26

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] smp: Make symbol 'csd_bug_count' static

The sparse tool complains as follows

kernel/smp.c:107:10: warning:
symbol 'csd_bug_count' was not declared. Should it be static?

This variable is not used outside of smp.c, s this commit marks
it static.

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Wei Yongjun <[email protected]>
---
kernel/smp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index 6ec6c9578225..65822c1c3e67 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -104,7 +104,7 @@ void __init call_function_init(void)
}

#define CSD_LOCK_TIMEOUT (5 * 1000ULL) /* Milliseconds. */
-atomic_t csd_bug_count = ATOMIC_INIT(0);
+static atomic_t csd_bug_count = ATOMIC_INIT(0);

/* Record current CSD work for current CPU, NULL to erase. */
static void csd_lock_record(call_single_data_t *csd)


2020-07-06 18:38:04

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH -next] smp: Make symbol 'csd_bug_count' static

On Mon, Jul 06, 2020 at 09:49:41PM +0800, Wei Yongjun wrote:
> The sparse tool complains as follows
>
> kernel/smp.c:107:10: warning:
> symbol 'csd_bug_count' was not declared. Should it be static?
>
> This variable is not used outside of smp.c, s this commit marks
> it static.
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Wei Yongjun <[email protected]>

Good catches, applied both, thank you!

Thanx, Paul

> ---
> kernel/smp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/smp.c b/kernel/smp.c
> index 6ec6c9578225..65822c1c3e67 100644
> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -104,7 +104,7 @@ void __init call_function_init(void)
> }
>
> #define CSD_LOCK_TIMEOUT (5 * 1000ULL) /* Milliseconds. */
> -atomic_t csd_bug_count = ATOMIC_INIT(0);
> +static atomic_t csd_bug_count = ATOMIC_INIT(0);
>
> /* Record current CSD work for current CPU, NULL to erase. */
> static void csd_lock_record(call_single_data_t *csd)
>