tests: linux_kernel: fix section mismatch warning in test module

The test kmod build has the following warning that I somehow didn't
notice before:

  WARNING: modpost: /home/osandov/repos/drgn-main/tests/linux_kernel/kmod/drgn_test.o(.init.text+0x3ac): Section mismatch in reference from the function init_module() to the function .exit.text:drgn_test_exit()
  The function __init init_module() references
  a function __exit drgn_test_exit().
  This is often seen when error handling in the init function
  uses functionality in the exit path.
  The fix is often to remove the __exit annotation of
  drgn_test_exit() so it may be used outside an exit section.

Remove the __exit annotation as suggested.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
This commit is contained in:
Omar Sandoval 2022-07-06 18:02:56 -07:00
parent 46367a437a
commit f56b2f117a

View File

@ -269,7 +269,7 @@ int drgn_test_function(int x)
return x + 1;
}
static void __exit drgn_test_exit(void)
static void drgn_test_exit(void)
{
drgn_test_slab_exit();
}