Skip to content

Commit b908046

Browse files
arndbmcgrof
authored andcommitted
samples/hw_breakpoint: fix building without module unloading
__symbol_put() is really meant as an internal helper and is not available when module unloading is disabled, unlike the previously used symbol_put(): samples/hw_breakpoint/data_breakpoint.c: In function 'hw_break_module_exit': samples/hw_breakpoint/data_breakpoint.c:73:9: error: implicit declaration of function '__symbol_put'; did you mean '__symbol_get'? [-Werror=implicit-function-declaration] The hw_break_module_exit() function is not actually used when module unloading is disabled, but it still causes the build failure for an undefined identifier. Enclose this one call in an appropriate #ifdef to clarify what the requirement is. Leaving out the entire exit function would also work but feels less clar in this case. Fixes: 910e230 ("samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000'") Fixes: d8a84d3 ("samples/hw_breakpoint: drop use of kallsyms_lookup_name()") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 910e230 commit b908046

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

samples/hw_breakpoint/data_breakpoint.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ static int __init hw_break_module_init(void)
7070
static void __exit hw_break_module_exit(void)
7171
{
7272
unregister_wide_hw_breakpoint(sample_hbp);
73+
#ifdef CONFIG_MODULE_UNLOAD
7374
__symbol_put(ksym_name);
75+
#endif
7476
printk(KERN_INFO "HW Breakpoint for %s write uninstalled\n", ksym_name);
7577
}
7678

0 commit comments

Comments
 (0)