kernel: refactor lookup_or_create_module_kobject()
authorShyam Saini <shyamsaini@linux.microsoft.com>
Thu, 27 Feb 2025 18:49:28 +0000 (10:49 -0800)
committerPetr Pavlu <petr.pavlu@suse.com>
Wed, 16 Apr 2025 12:54:35 +0000 (14:54 +0200)
commit1c7777feb0e2f5925908c489513656ebb443a699
tree6c6d919281d4eacb84447da634e6211dd26e1fee
parentbbc9462f0cb0c8917a4908e856731708f0cee910
kernel: refactor lookup_or_create_module_kobject()

In the unlikely event of the allocation failing, it is better to let
the machine boot with a not fully populated sysfs than to kill it with
this BUG_ON(). All callers are already prepared for
lookup_or_create_module_kobject() returning NULL.

This is also preparation for calling this function from non __init
code, where using BUG_ON for allocation failure handling is not
acceptable.

Since we are here, also start using IS_ENABLED instead of #ifdef
construct.

Suggested-by: Thomas Weißschuh <linux@weissschuh.net>
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Shyam Saini <shyamsaini@linux.microsoft.com>
Link: https://lore.kernel.org/r/20250227184930.34163-3-shyamsaini@linux.microsoft.com
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
kernel/params.c