Linux加载模块时出错:sysfs: cannot create duplicate filename ‘/class/beep’

------------[ cut here ]------------
WARNING: CPU: 0 PID: 95 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x54/0x74()
sysfs: cannot create duplicate filename ‘/class/beep’
Modules linked in: beep(O+) [last unloaded: beep]
CPU: 0 PID: 95 Comm: insmod Tainted: G O 4.1.15 #2
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015ed4>] (unwind_backtrace) from [<80012794>] (show_stack+0x10/0x14)
[<80012794>] (show_stack) from [<8068cd74>] (dump_stack+0x80/0xc8)
[<8068cd74>] (dump_stack) from [<8003824c>] (warn_slowpath_common+0x74/0xb0)
[<8003824c>] (warn_slowpath_common) from [<800382b8>] (warn_slowpath_fmt+0x30/0x40)
[<800382b8>] (warn_slowpath_fmt) from [<8014b774>] (sysfs_warn_dup+0x54/0x74)
[<8014b774>] (sysfs_warn_dup) from [<8014b860>] (sysfs_create_dir_ns+0x84/0x9c)
[<8014b860>] (sysfs_create_dir_ns) from [<8029e380>] (kobject_add_internal+0xa0/0x2d8)
[<8029e380>] (kobject_add_internal) from [<8029e670>] (kset_register+0x50/0x7c)
[<8029e670>] (kset_register) from [<8034e604>] (__class_register+0xa8/0x1bc)
[<8034e604>] (__class_register) from [<8034e758>] (__class_create+0x40/0x78)
[<8034e758>] (__class_create) from [<7f00e0d4>] (beep_init+0xd4/0x130 [beep])
[<7f00e0d4>] (beep_init [beep]) from [<80009704>] (do_one_initcall+0x80/0x1d8)
[<80009704>] (do_one_initcall) from [<8068ac60>] (do_init_module+0x58/0x1a8)
[<8068ac60>] (do_init_module) from [<80095e48>] (load_module+0x165c/0x1d48)
[<80095e48>] (load_module) from [<80096600>] (SyS_init_module+0xcc/0x124)
[<80096600>] (SyS_init_module) from [<8000f500>] (ret_fast_syscall+0x0/0x3c)
—[ end trace 83f45b6703b52db8 ]—
------------[ cut here ]------------
WARNING: CPU: 0 PID: 95 at lib/kobject.c:240 kobject_add_internal+0x25c/0x2d8()
kobject_add_internal failed for beep with -EEXIST, don’t try to register things with the same name in the same d.
Modules linked in: beep(O+) [last unloaded: beep]
CPU: 0 PID: 95 Comm: insmod Tainted: G W O 4.1.15 #2
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015ed4>] (unwind_backtrace) from [<80012794>] (show_stack+0x10/0x14)
[<80012794>] (show_stack) from [<8068cd74>] (dump_stack+0x80/0xc8)
[<8068cd74>] (dump_stack) from [<8003824c>] (warn_slowpath_common+0x74/0xb0)
[<8003824c>] (warn_slowpath_common) from [<800382b8>] (warn_slowpath_fmt+0x30/0x40)
[<800382b8>] (warn_slowpath_fmt) from [<8029e53c>] (kobject_add_internal+0x25c/0x2d8)
[<8029e53c>] (kobject_add_internal) from [<8029e670>] (kset_register+0x50/0x7c)
[<8029e670>] (kset_register) from [<8034e604>] (__class_register+0xa8/0x1bc)
[<8034e604>] (__class_register) from [<8034e758>] (__class_create+0x40/0x78)
[<8034e758>] (__class_create) from [<7f00e0d4>] (beep_init+0xd4/0x130 [beep])
[<7f00e0d4>] (beep_init [beep]) from [<80009704>] (do_one_initcall+0x80/0x1d8)
[<80009704>] (do_one_initcall) from [<8068ac60>] (do_init_module+0x58/0x1a8)
[<8068ac60>] (do_init_module) from [<80095e48>] (load_module+0x165c/0x1d48)
[<80095e48>] (load_module) from [<80096600>] (SyS_init_module+0xcc/0x124)
[<80096600>] (SyS_init_module) from [<8000f500>] (ret_fast_syscall+0x0/0x3c)
—[ end trace 83f45b6703b52db9 ]—
insmod: can’t insert ‘beep.ko’: No such device

原因一:模块初始化函数缺少了返回值 记得末尾加上返回值!
原因二:模块名字有了,改一个,比如我的leds死活不行,改到led,但是引脚还是不能用。我猜肯定是LED被占用了,还在了解中。

记得点赞(⊙o⊙)哦!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值