All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Address Sparse Static Warning inside kernel/fork.c
@ 2009-08-06 17:06 Subrata Modak
  2009-08-06 17:22 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Subrata Modak @ 2009-08-06 17:06 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Sachin P Sant, Subrata Modak, Balbir Singh, LKML

Hi Ingo,

The patch below fixes the following SPARSE warning:
kernel/fork.c:81:5: warning: symbol 'max_threads' was not declared. Should it be static?
kernel/fork.c:171:13: warning: symbol 'fork_init' was not declared. Should it be static?

Signed-off-by: Subrata Modak<subrata@linux.vnet.ibm.com>

To: Ingo Molnar <mingo@elte.hu>,
Cc: LKML <linux-kernel@vger.kernel.org>,
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>,
Cc: Sachin P Sant <sachinp@linux.vnet.ibm.com>,
---

--- a/kernel/fork.c	2009-08-05 12:00:51.000000000 +0530
+++ b/kernel/fork.c	2009-08-06 22:26:30.000000000 +0530
@@ -78,7 +78,7 @@
 unsigned long total_forks;	/* Handle normal Linux uptimes. */
 int nr_threads; 		/* The idle threads do not count.. */
 
-int max_threads;		/* tunable limit on nr_threads */
+static int max_threads;		/* tunable limit on nr_threads */
 
 DEFINE_PER_CPU(unsigned long, process_counts) = 0;
 
@@ -168,7 +168,7 @@ void __put_task_struct(struct task_struc
 #define arch_task_cache_init()
 #endif
 
-void __init fork_init(unsigned long mempages)
+static void __init fork_init(unsigned long mempages)
 {
 #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
 #ifndef ARCH_MIN_TASKALIGN

Regards--
Subrata


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

* Re: [PATCH] Address Sparse Static Warning inside kernel/fork.c
  2009-08-06 17:06 [PATCH] Address Sparse Static Warning inside kernel/fork.c Subrata Modak
@ 2009-08-06 17:22 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2009-08-06 17:22 UTC (permalink / raw)
  To: Subrata Modak; +Cc: Ingo Molnar, Sachin P Sant, Balbir Singh, LKML

On Thursday 06 August 2009, Subrata Modak wrote:
> --- a/kernel/fork.c	2009-08-05 12:00:51.000000000 +0530
> +++ b/kernel/fork.c	2009-08-06 22:26:30.000000000 +0530
> @@ -78,7 +78,7 @@
>  unsigned long total_forks;	/* Handle normal Linux uptimes. */
>  int nr_threads; 		/* The idle threads do not count.. */
>  
> -int max_threads;		/* tunable limit on nr_threads */
> +static int max_threads;		/* tunable limit on nr_threads */
>  
>  DEFINE_PER_CPU(unsigned long, process_counts) = 0;
>  
> @@ -168,7 +168,7 @@ void __put_task_struct(struct task_struc
>  #define arch_task_cache_init()
>  #endif
>  
> -void __init fork_init(unsigned long mempages)
> +static void __init fork_init(unsigned long mempages)
>  {
>  #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
>  #ifndef ARCH_MIN_TASKALIGN

These are both wrong (you didn't try compiling the kernel with
that patch, did you?):
fork_init() is called from init/main.c, max_threads is accessed
in kernel/sysctl.c.

If you had tried building this, you would have seen a warning about
unused symbols in the compile stage, followed by a linker error.

I would still be good to address these two though. Please do a
patch that moves the extern declarations for these two symbols
to an appropriate header file that is included in fork.c.

	Arnd <><

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

end of thread, other threads:[~2009-08-06 17:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-06 17:06 [PATCH] Address Sparse Static Warning inside kernel/fork.c Subrata Modak
2009-08-06 17:22 ` Arnd Bergmann

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.