I fix the same error by using the same GCC version as which have compiled the running kernel to compile my module, both 8.3.1; Please check on yours.
[root@centos fishing]# dmesg | grep gcc
[ 0.000000] Linux version 4.18.0-80.7.2.el7.aarch64 ([email protected]) (gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)) #1 SMP Thu Sep 12 16:13:20 UTC 2019
[root@centos fishing]# gcc -v
gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)
[root@centos fishing]#
Otherwise, I had errors:
[root@centos fishing]# rmmod fishing
rmmod: ERROR: could not remove 'fishing': Device or resource busy
rmmod: ERROR: could not remove module fishing: Device or resource busy
[root@centos fishing]#
the kernel module, fishing code is from http://books.gigatux.nl/mirror/kerneldevelopment/0672327201/ch16lev2sec1.html
rmmod -f
doesn't work, it printsERROR: device or resource busy
– Casing