[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20130430100358.f3209dd5.akpm@linux-foundation.org>
Date: Tue, 30 Apr 2013 10:03:58 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: David Rientjes <rientjes@...gle.com>
Cc: Vincent Stehlé <vincent.stehle@...oste.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] memory hotplug: fix warnings
On Tue, 30 Apr 2013 09:54:18 -0700 (PDT) David Rientjes <rientjes@...gle.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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists