mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] memory hotplug: fix warnings
@ 2013-04-30  8:31 Vincent Stehlé
  2013-04-30 16:17 ` David Rientjes
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent Stehlé @ 2013-04-30  8:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: David Rientjes, linux-kernel, Vincent Stehlé

Fix the following compilation warnings:

  mm/slab.c: In function ‘kmem_cache_init_late’:
  mm/slab.c:1778:2: warning: statement with no effect [-Wunused-value]

  mm/page_cgroup.c: In function ‘page_cgroup_init’:
  mm/page_cgroup.c:305:2: warning: statement with no effect [-Wunused-value]

Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
---
 include/linux/memory.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/memory.h b/include/linux/memory.h
index 73817af..85c31a8 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -137,7 +137,7 @@ enum mem_add_context { BOOT, HOTPLUG };
 #define register_hotmemory_notifier(nb)		register_memory_notifier(nb)
 #define unregister_hotmemory_notifier(nb) 	unregister_memory_notifier(nb)
 #else
-#define hotplug_memory_notifier(fn, pri)	(0)
+#define hotplug_memory_notifier(fn, pri)	({ 0; })
 /* These aren't inline functions due to a GCC bug. */
 #define register_hotmemory_notifier(nb)    ({ (void)(nb); 0; })
 #define unregister_hotmemory_notifier(nb)  ({ (void)(nb); })
-- 
1.7.10.4


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

* Re: [PATCH] memory hotplug: fix warnings
  2013-04-30  8:31 [PATCH] memory hotplug: fix warnings Vincent Stehlé
@ 2013-04-30 16:17 ` David Rientjes
  2013-04-30 16:29   ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: David Rientjes @ 2013-04-30 16:17 UTC (permalink / raw)
  To: Vincent Stehlé; +Cc: Andrew Morton, linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 756 bytes --]

On Tue, 30 Apr 2013, Vincent Stehlé wrote:

> diff --git a/include/linux/memory.h b/include/linux/memory.h
> index 73817af..85c31a8 100644
> --- a/include/linux/memory.h
> +++ b/include/linux/memory.h
> @@ -137,7 +137,7 @@ enum mem_add_context { BOOT, HOTPLUG };
>  #define register_hotmemory_notifier(nb)		register_memory_notifier(nb)
>  #define unregister_hotmemory_notifier(nb) 	unregister_memory_notifier(nb)
>  #else
> -#define hotplug_memory_notifier(fn, pri)	(0)
> +#define hotplug_memory_notifier(fn, pri)	({ 0; })
>  /* These aren't inline functions due to a GCC bug. */
>  #define register_hotmemory_notifier(nb)    ({ (void)(nb); 0; })
>  #define unregister_hotmemory_notifier(nb)  ({ (void)(nb); })

You can't use the standard do {} while (0)?

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

* Re: [PATCH] memory hotplug: fix warnings
  2013-04-30 16:17 ` David Rientjes
@ 2013-04-30 16:29   ` Andrew Morton
  2013-04-30 16:54     ` David Rientjes
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2013-04-30 16:29 UTC (permalink / raw)
  To: David Rientjes; +Cc: Vincent Stehlé, linux-kernel

On Tue, 30 Apr 2013 09:17:11 -0700 (PDT) David Rientjes <rientjes@google.com> wrote:

> On Tue, 30 Apr 2013, Vincent Stehl__ wrote:
> 
> > diff --git a/include/linux/memory.h b/include/linux/memory.h
> > index 73817af..85c31a8 100644
> > --- a/include/linux/memory.h
> > +++ b/include/linux/memory.h
> > @@ -137,7 +137,7 @@ enum mem_add_context { BOOT, HOTPLUG };
> >  #define register_hotmemory_notifier(nb)		register_memory_notifier(nb)
> >  #define unregister_hotmemory_notifier(nb) 	unregister_memory_notifier(nb)
> >  #else
> > -#define hotplug_memory_notifier(fn, pri)	(0)
> > +#define hotplug_memory_notifier(fn, pri)	({ 0; })
> >  /* These aren't inline functions due to a GCC bug. */
> >  #define register_hotmemory_notifier(nb)    ({ (void)(nb); 0; })
> >  #define unregister_hotmemory_notifier(nb)  ({ (void)(nb); })
> 
> You can't use the standard do {} while (0)?

register_memory_notifier() (and hence hotplug_memory_notifier())
returns an errno.  Which nobody bothers checking.

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

* Re: [PATCH] memory hotplug: fix warnings
  2013-04-30 16:29   ` Andrew Morton
@ 2013-04-30 16:54     ` David Rientjes
  2013-04-30 17:03       ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: David Rientjes @ 2013-04-30 16:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Vincent Stehlé, linux-kernel

On Tue, 30 Apr 2013, Andrew Morton wrote:

> > > diff --git a/include/linux/memory.h b/include/linux/memory.h
> > > index 73817af..85c31a8 100644
> > > --- a/include/linux/memory.h
> > > +++ b/include/linux/memory.h
> > > @@ -137,7 +137,7 @@ enum mem_add_context { BOOT, HOTPLUG };
> > >  #define register_hotmemory_notifier(nb)		register_memory_notifier(nb)
> > >  #define unregister_hotmemory_notifier(nb) 	unregister_memory_notifier(nb)
> > >  #else
> > > -#define hotplug_memory_notifier(fn, pri)	(0)
> > > +#define hotplug_memory_notifier(fn, pri)	({ 0; })
> > >  /* These aren't inline functions due to a GCC bug. */
> > >  #define register_hotmemory_notifier(nb)    ({ (void)(nb); 0; })
> > >  #define unregister_hotmemory_notifier(nb)  ({ (void)(nb); })
> > 
> > You can't use the standard do {} while (0)?
> 
> register_memory_notifier() (and hence hotplug_memory_notifier())
> returns an errno.  Which nobody bothers checking.
> 

The notifier itself is statically allocated so there's no memory 
allocations in this path, there's no chance it'll fail.  Should we just 
make register_memory_notifier() return void?

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

* Re: [PATCH] memory hotplug: fix warnings
  2013-04-30 16:54     ` David Rientjes
@ 2013-04-30 17:03       ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2013-04-30 17:03 UTC (permalink / raw)
  To: David Rientjes; +Cc: Vincent Stehlé, linux-kernel

On Tue, 30 Apr 2013 09:54:18 -0700 (PDT) David Rientjes <rientjes@google.com> wrote:

> On Tue, 30 Apr 2013, Andrew Morton wrote:
> 
> > > > diff --git a/include/linux/memory.h b/include/linux/memory.h
> > > > index 73817af..85c31a8 100644
> > > > --- a/include/linux/memory.h
> > > > +++ b/include/linux/memory.h
> > > > @@ -137,7 +137,7 @@ enum mem_add_context { BOOT, HOTPLUG };
> > > >  #define register_hotmemory_notifier(nb)		register_memory_notifier(nb)
> > > >  #define unregister_hotmemory_notifier(nb) 	unregister_memory_notifier(nb)
> > > >  #else
> > > > -#define hotplug_memory_notifier(fn, pri)	(0)
> > > > +#define hotplug_memory_notifier(fn, pri)	({ 0; })
> > > >  /* These aren't inline functions due to a GCC bug. */
> > > >  #define register_hotmemory_notifier(nb)    ({ (void)(nb); 0; })
> > > >  #define unregister_hotmemory_notifier(nb)  ({ (void)(nb); })
> > > 
> > > You can't use the standard do {} while (0)?
> > 
> > register_memory_notifier() (and hence hotplug_memory_notifier())
> > returns an errno.  Which nobody bothers checking.
> > 
> 
> The notifier itself is statically allocated so there's no memory 
> allocations in this path, there's no chance it'll fail.  Should we just 
> make register_memory_notifier() return void?

Drill down and we end up in notifier_chain_register(), which
unconditionally returns 0.

So we can either leave things as they are under the assumption that
notifier_chain_register() might one day be changed to return an errno
or we can change everything to return void.


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

end of thread, other threads:[~2013-04-30 17:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-30  8:31 [PATCH] memory hotplug: fix warnings Vincent Stehlé
2013-04-30 16:17 ` David Rientjes
2013-04-30 16:29   ` Andrew Morton
2013-04-30 16:54     ` David Rientjes
2013-04-30 17:03       ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®