warn_on.c 367 B

12345678910111213141516171819202122
  1. /* https://cirosantilli.com/linux-kernel-module-cheat#warn_on */
  2. #include <linux/module.h>
  3. #include <linux/kernel.h>
  4. static int myinit(void)
  5. {
  6. pr_info("warn_on init\n");
  7. WARN_ON("warn_on do it");
  8. pr_info("warn_on after\n");
  9. return 0;
  10. }
  11. static void myexit(void)
  12. {
  13. pr_info("warn_on cleanup\n");
  14. }
  15. module_init(myinit)
  16. module_exit(myexit)
  17. MODULE_LICENSE("GPL");