Skip to contentSkip to conversation

pstore: remove __exit annotation for ramoops_remove

PATCH In review Arnd Bergmann 3 participants 3 messages Oct 22, 2015 Pstore filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pstore: remove __exit annotation for ramoops_remove

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

Fixes 2adb611ef932 ("pstore: add pstore unregister")
fs/pstore/ram.c +1 -1
index 68889a727bc7..319c3a60cfa5 100644
@@ -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;
 
reviewer
#1 lore raw

-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

Acked-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

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.

Quoted 17 lines
Fixes 2adb611ef932 ("pstore: add pstore unregister")
fs/pstore/ram.c +1 -1
index 68889a727bc7..319c3a60cfa5 100644
@@ -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;