title: Graceful fail in linux kerenl init_module
body: <p>I am working on a kernel module, and I would like to do some checks before loading the module. However, I cannot gracefully prevent module from loading if some checks fail. If module_init function returns a non zero value this causes kernel to crush on my system. </p>
  
  <p>How can I stop module initialization without crushing the kernel? For example just to print an error message etc.</p>
  
  <pre><code>static int timer_init(void){
      ...
      if (OK)
         return 0;
      else:
         return -EINVAL;
   }
   static void timer_exit(void) {
   ....
   }
   module_init(timer_init);
   module_exit(timer_exit);
  </code></pre>
  
  <p>Thanks!</p>