From: Daniel Gomez <da.gomez@samsung.com>
The error code -EEXIST is reserved by the kernel module loader to
indicate that a module with the same name is already loaded. Add
a warning note to clarify what these means for module authors and
maintainers to ensure the module_init() path return error do not
conflict with the reserved one.
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Documentation/kernel-hacking/hacking.rst | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/kernel-hacking/hacking.rst b/Documentation/kernel-hacking/hacking.rst
index 0042776a9e17..2c929ab93143 100644
--- a/Documentation/kernel-hacking/hacking.rst
+++ b/Documentation/kernel-hacking/hacking.rst
@@ -459,6 +459,13 @@ to fail (unfortunately, this has no effect if the module is compiled
into the kernel). This function is called in user context with
interrupts enabled, so it can sleep.
+.. warning::
+
+ The error code ``-EEXIST`` is reserved by the module loader to
+ indicate a module is already loaded. kmod interprets this as success,
+ so ``module_init()`` must never return ``-EEXIST``. Use ``-EBUSY`` or
+ ``-EALREADY`` instead.
+
:c:func:`module_exit()`
-----------------------
--
2.52.0