summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2023-07-25 10:25:36 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-09-23 11:10:01 +0200
commitabdfde0377124ed0e3821e52dd420432d3c645c7 (patch)
tree33d31d8e5c750f3e99b82c5567aba8dd293b655d /samples
parent58787ff3d0233d400bce5cda7bd7fc4823e3bd9f (diff)
downloadlinux-abdfde0377124ed0e3821e52dd420432d3c645c7.tar.gz
linux-abdfde0377124ed0e3821e52dd420432d3c645c7.tar.bz2
linux-abdfde0377124ed0e3821e52dd420432d3c645c7.zip
samples/hw_breakpoint: fix building without module unloading
[ Upstream commit b9080468caeddc58a91edd1c3a7d212ea82b0d1d ] __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: 910e230d5f1bb ("samples/hw_breakpoint: Fix kernel BUG 'invalid opcode: 0000'") Fixes: d8a84d33a4954 ("samples/hw_breakpoint: drop use of kallsyms_lookup_name()") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'samples')
-rw-r--r--samples/hw_breakpoint/data_breakpoint.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/samples/hw_breakpoint/data_breakpoint.c b/samples/hw_breakpoint/data_breakpoint.c
index 9debd128b2ab..b99322f188e5 100644
--- a/samples/hw_breakpoint/data_breakpoint.c
+++ b/samples/hw_breakpoint/data_breakpoint.c
@@ -70,7 +70,9 @@ fail:
static void __exit hw_break_module_exit(void)
{
unregister_wide_hw_breakpoint(sample_hbp);
+#ifdef CONFIG_MODULE_UNLOAD
__symbol_put(ksym_name);
+#endif
printk(KERN_INFO "HW Breakpoint for %s write uninstalled\n", ksym_name);
}