int *catch;
int start(void)
{
alloc_chrdev_region(catch,0,1,"scull");
printk(KERN_ALERT "The current process is \"%s\" (pid %i)\n",current->comm, current->pid);
return 0;
}
void end(void)
{
printk(KERN_ALERT "Goodbye, Stupid World\n");
unregister_chrdev_region(*catch,1);
}
module_init(start);
module_exit(end);
如果我尝试运行相同的代码,只将catch作为整数而不是指针,它可以正常工作。