Skip to contentSkip to conversation

lib: cleanup dead code from rbtree_test.c

PATCH In review Pravin Shedge 2 participants 3 messages Dec 17, 2017 – Dec 19, 2017 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 lib: cleanup dead code from rbtree_test.c

lib/rbtree_test.c code allows to compile either as a loadable modules or builtin into the kernel.

Current code returns -EAGAIN on successful termination from module_init. Such a fail will directly unload the module and hence there is no scope to execute rbtree_test_exit on module_exit.

This patch will cleanup dead code from rbtree_test.c

---
 lib/rbtree_test.c | 6 ------
 1 file changed, 6 deletions(-)
lib/rbtree_test.c +0 -6
index 7d36c1e..5cd2f26 100644
@@ -397,13 +397,7 @@ static int __init rbtree_test_init(void)
 	return -EAGAIN; /* Fail will directly unload the module */
 }
 
-static void __exit rbtree_test_exit(void)
-{
-	printk(KERN_ALERT "test exit\n");
-}
-
 module_init(rbtree_test_init)
-module_exit(rbtree_test_exit)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Michel Lespinasse");
Signature · 1 line
2.7.4
#1 lore raw
Quoted 8 lines · Pravin Shedge

lib/rbtree_test.c code allows to compile either as a loadable modules or builtin into the kernel.

Current code returns -EAGAIN on successful termination from module_init. Such a fail will directly unload the module and hence there is no scope to execute rbtree_test_exit on module_exit.

This patch will cleanup dead code from rbtree_test.c

Being completely harmless I'd rather leave this as is. If removed, the module breaks generic layout.

Thanks,
Davidlohr

Quoted 27 lines

---
lib/rbtree_test.c | 6 ------

1 file changed, 6 deletions(-)
lib/rbtree_test.c +0 -6
index 7d36c1e..5cd2f26 100644
@@ -397,13 +397,7 @@ static int __init rbtree_test_init(void)
 	return -EAGAIN; /* Fail will directly unload the module */
 }
 
-static void __exit rbtree_test_exit(void)
-{
-	printk(KERN_ALERT "test exit\n");
-}
-
 module_init(rbtree_test_init)
-module_exit(rbtree_test_exit)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Michel Lespinasse");
Signature · 1 line
2.7.4
#2 lore raw
Quoted 9 lines · Davidlohr Bueso
Quoted 7 lines · Pravin Shedge

lib/rbtree_test.c code allows to compile either as a loadable modules or builtin into the kernel.

Current code returns -EAGAIN on successful termination from module_init. Such a fail will directly unload the module and hence there is no scope to execute rbtree_test_exit on module_exit.

Quoted 6 lines
Quoted 1 line

This patch will cleanup dead code from rbtree_test.c

Being completely harmless I'd rather leave this as is. If removed, the module breaks generic layout.

Right this code is not harmless but at the same time I am not sure How other modules [from lib/test_sort.c] added in kernel ?

Little curious, Just for my knowledge
how it breaks generic layout ? and what will be the impact ?

Quoted 32 lines

Thanks,
Davidlohr

Quoted 27 lines

---
lib/rbtree_test.c | 6 ------

1 file changed, 6 deletions(-)
lib/rbtree_test.c +0 -7
index 7d36c1e..5cd2f26 100644
@@ -397,13 +397,7 @@ static int __init rbtree_test_init(void)
        return -EAGAIN; /* Fail will directly unload the module */
 }
 
-static void __exit rbtree_test_exit(void)
-{
-       printk(KERN_ALERT "test exit\n");
-}
-
 module_init(rbtree_test_init)
-module_exit(rbtree_test_exit)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Michel Lespinasse");
--

2.7.4