* [PATCH 1/1] KERNEL: add __attribute__ in c file
@ 2014-05-07 20:33 Fabian Frederick
2014-05-07 22:25 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Fabian Frederick @ 2014-05-07 20:33 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, Rusty Russell
This patch fixes a sparse warning about noreturn attribute only
featuring in module.h
kernel/module.c:212:6: error: symbol '__module_put_and_exit' redeclared with
different type (originally declared at include/linux/module.h:449)-
different modifiers
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
include/linux/module.h | 4 ++--
kernel/module.c | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/linux/module.h b/include/linux/module.h
index f520a76..05ab8f3 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -446,8 +446,8 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
struct module *, unsigned long),
void *data);
-extern void __module_put_and_exit(struct module *mod, long code)
- __attribute__((noreturn));
+extern void __attribute__((noreturn)) __module_put_and_exit(struct module *mod,
+ long code);
#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code)
#ifdef CONFIG_MODULE_UNLOAD
diff --git a/kernel/module.c b/kernel/module.c
index 079c461..7d78872 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -209,7 +209,8 @@ static inline void add_taint_module(struct module *mod, unsigned flag,
* A thread that wants to hold a reference to a module only while it
* is running can call this to safely exit. nfsd and lockd use this.
*/
-void __module_put_and_exit(struct module *mod, long code)
+void __attribute__((noreturn)) __module_put_and_exit(struct module *mod,
+ long code)
{
module_put(mod);
do_exit(code);
--
1.8.4.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] KERNEL: add __attribute__ in c file
2014-05-07 20:33 [PATCH 1/1] KERNEL: add __attribute__ in c file Fabian Frederick
@ 2014-05-07 22:25 ` Andrew Morton
2014-05-10 10:16 ` Fabian Frederick
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2014-05-07 22:25 UTC (permalink / raw)
To: Fabian Frederick; +Cc: linux-kernel, Rusty Russell
On Wed, 7 May 2014 22:33:39 +0200 Fabian Frederick <fabf@skynet.be> wrote:
> This patch fixes a sparse warning about noreturn attribute only
> featuring in module.h
>
> kernel/module.c:212:6: error: symbol '__module_put_and_exit' redeclared with
> different type (originally declared at include/linux/module.h:449)-
> different modifiers
>
> ...
>
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -446,8 +446,8 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
> struct module *, unsigned long),
> void *data);
>
> -extern void __module_put_and_exit(struct module *mod, long code)
> - __attribute__((noreturn));
> +extern void __attribute__((noreturn)) __module_put_and_exit(struct module *mod,
> + long code);
> #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code)
>
> #ifdef CONFIG_MODULE_UNLOAD
> diff --git a/kernel/module.c b/kernel/module.c
> index 079c461..7d78872 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -209,7 +209,8 @@ static inline void add_taint_module(struct module *mod, unsigned flag,
> * A thread that wants to hold a reference to a module only while it
> * is running can call this to safely exit. nfsd and lockd use this.
> */
> -void __module_put_and_exit(struct module *mod, long code)
> +void __attribute__((noreturn)) __module_put_and_exit(struct module *mod,
> + long code)
> {
Can we use __noreturn here?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] KERNEL: add __attribute__ in c file
2014-05-07 22:25 ` Andrew Morton
@ 2014-05-10 10:16 ` Fabian Frederick
0 siblings, 0 replies; 3+ messages in thread
From: Fabian Frederick @ 2014-05-10 10:16 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Rusty Russell
On Wed, 7 May 2014 15:25:57 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 7 May 2014 22:33:39 +0200 Fabian Frederick <fabf@skynet.be> wrote:
>
> > This patch fixes a sparse warning about noreturn attribute only
> > featuring in module.h
> >
> > kernel/module.c:212:6: error: symbol '__module_put_and_exit' redeclared with
> > different type (originally declared at include/linux/module.h:449)-
> > different modifiers
> >
> > ...
> >
> > --- a/include/linux/module.h
> > +++ b/include/linux/module.h
> > @@ -446,8 +446,8 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
> > struct module *, unsigned long),
> > void *data);
> >
> > -extern void __module_put_and_exit(struct module *mod, long code)
> > - __attribute__((noreturn));
> > +extern void __attribute__((noreturn)) __module_put_and_exit(struct module *mod,
> > + long code);
> > #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code)
> >
> > #ifdef CONFIG_MODULE_UNLOAD
> > diff --git a/kernel/module.c b/kernel/module.c
> > index 079c461..7d78872 100644
> > --- a/kernel/module.c
> > +++ b/kernel/module.c
> > @@ -209,7 +209,8 @@ static inline void add_taint_module(struct module *mod, unsigned flag,
> > * A thread that wants to hold a reference to a module only while it
> > * is running can call this to safely exit. nfsd and lockd use this.
> > */
> > -void __module_put_and_exit(struct module *mod, long code)
> > +void __attribute__((noreturn)) __module_put_and_exit(struct module *mod,
> > + long code)
> > {
>
> Can we use __noreturn here?
Well it works(compilation/no more sparse warning) but after looking at some documentation, it looks more like some sparse false positive.
Fabian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-10 10:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-07 20:33 [PATCH 1/1] KERNEL: add __attribute__ in c file Fabian Frederick
2014-05-07 22:25 ` Andrew Morton
2014-05-10 10:16 ` Fabian Frederick
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®