//出现的错误
[root@XC2440 nfs]# insmod test.ko
in the function:led_initsys_init_module: 'test'->init suspiciously returned 1, it should follow 0/-E convention
sys_init_module: loading module anyway...
[<c003a334>] (unwind_backtrace+0x0/0xe4) from [<c0070db0>] (sys_init_module+0x108/0x1b4)
[<c0070db0>] (sys_init_module+0x108/0x1b4) from [<c0034c00>] (ret_fast_syscall+0x0/0x2c)
//代码
static int __init led_init(void)
{
printk("in the function:%s\n", __FUNCTION__);
int ret = 0;
printk("say hello to led\n");
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) {
printk("kzalloc() failed!\n");
ret = -ENOMEM;
goto e_kzalloc;
return 1; //出现这样的情况就是因为,返回值必须是0,或者是负数. 写成非负就不行..
e_kzalloc:
return ret;
}