All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pstore: remove __exit annotation for ramoops_remove
@ 2015-10-22 14:52 Arnd Bergmann
  2015-10-22 16:05 ` Luck, Tony
  2015-10-22 16:09 ` Geliang Tang
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2015-10-22 14:52 UTC (permalink / raw)
  To: Tony Luck
  Cc: Anton Vorontsov, Colin Cross, Kees Cook, linux-kernel, Geliang Tang

The remove function of a device driver should not be marked
__exit, because that section gets discarded for built-in drivers,
and it is still possible to manually unbind a driver from a
device, which would result in a runtime error.

The kernel also produces a link error for this when the module
is built-in:

`ramoops_remove' referenced in section `.data' of fs/built-in.o: defined in discarded section `.exit.text' of fs/built-in.o

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 2adb611ef932 ("pstore: add pstore unregister")

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 68889a727bc7..319c3a60cfa5 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -578,7 +578,7 @@ fail_out:
 	return err;
 }
 
-static int __exit ramoops_remove(struct platform_device *pdev)
+static int ramoops_remove(struct platform_device *pdev)
 {
 	struct ramoops_context *cxt = &oops_cxt;
 


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

* RE: [PATCH] pstore: remove __exit annotation for ramoops_remove
  2015-10-22 14:52 [PATCH] pstore: remove __exit annotation for ramoops_remove Arnd Bergmann
@ 2015-10-22 16:05 ` Luck, Tony
  2015-10-22 16:09 ` Geliang Tang
  1 sibling, 0 replies; 3+ messages in thread
From: Luck, Tony @ 2015-10-22 16:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Anton Vorontsov, Colin Cross, Kees Cook, linux-kernel, Geliang Tang

-static int __exit ramoops_remove(struct platform_device *pdev)
+static int ramoops_remove(struct platform_device *pdev)
 
Arnd,

Thanks.  I folded that fix into the commit that made the error and rebased (I don't believe
anyone is foolish enough to base work on my "next" branch)

-Tony


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

* Re: [PATCH] pstore: remove __exit annotation for ramoops_remove
  2015-10-22 14:52 [PATCH] pstore: remove __exit annotation for ramoops_remove Arnd Bergmann
  2015-10-22 16:05 ` Luck, Tony
@ 2015-10-22 16:09 ` Geliang Tang
  1 sibling, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2015-10-22 16:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck, linux-kernel,
	Geliang Tang

On Thu, Oct 22, 2015 at 04:52:33PM +0200, Arnd Bergmann wrote:
> The remove function of a device driver should not be marked
> __exit, because that section gets discarded for built-in drivers,
> and it is still possible to manually unbind a driver from a
> device, which would result in a runtime error.
> 
> The kernel also produces a link error for this when the module
> is built-in:
> 
> `ramoops_remove' referenced in section `.data' of fs/built-in.o: defined in discarded section `.exit.text' of fs/built-in.o

I can't see why it wasn't reported as an error on my machine.
But I think you are right. __exit should't be there.

Acked-by: Geliang Tang <geliangtang@163.com>

> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 2adb611ef932 ("pstore: add pstore unregister")
> 
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index 68889a727bc7..319c3a60cfa5 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -578,7 +578,7 @@ fail_out:
>  	return err;
>  }
>  
> -static int __exit ramoops_remove(struct platform_device *pdev)
> +static int ramoops_remove(struct platform_device *pdev)
>  {
>  	struct ramoops_context *cxt = &oops_cxt;
>  


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

end of thread, other threads:[~2015-10-22 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 14:52 [PATCH] pstore: remove __exit annotation for ramoops_remove Arnd Bergmann
2015-10-22 16:05 ` Luck, Tony
2015-10-22 16:09 ` Geliang Tang

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.