[置顶] 关于加载驱动rtl8188EUS(8188eu.ko)到内核3.15出现段错误

加载rtl8188EUS的驱动8188eu.ko到开发板。出现以下的段错误。内核版本:3.15。开发板型号:ATSAMAD535

段错误

insmod 8188eu.ko 
RTL871X: module init start
RTL871X: rtl8188eu v4.3.0_10600.20140220
RTL871X: build time: Oct 20 2014 10:22:58
Unable to handle kernel NULL pointer dereference at virtual address 00000028
pgd = cfb68000
[00000028] *pgd=2f9ab831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] ARM
Modules linked in: 8188eu(O+)
CPU: 0 PID: 563 Comm: insmod Tainted: G           O  3.15.0 #68
task: cf9db480 ti: cfa04000 task.ti: cfa04000
PC is at rtw_ndev_notifier_call+0x18/0x6c [8188eu]
LR is at register_netdevice_notifier+0x7c/0x19c
pc : [<bf0389bc>]    lr : [<c0304180>]    psr: 80000013
sp : cfa05de8  ip : bf049910  fp : 00000000
r10: c05bf7f0  r9 : 00000000  r8 : c05bfab0
r7 : bf0bc29c  r6 : cf983000  r5 : 00000005  r4 : cfa05dfc
r3 : bf0389a4  r2 : 00000000  r1 : 00000005  r0 : bf0a4e5c
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c53c7d  Table: 2fb68059  DAC: 00000015
Process insmod (pid: 563, stack limit = 0xcfa04238)
Stack: (0xcfa05de8 to 0xcfa06000)
5de0:                   bf0389a4 bf0a4e5c c05bf858 c0304180 bf0da000 cf983000
5e00: bf0a4f10 00000001 bf0bc2a8 bf0bc29c bf0da000 00000001 cfa04030 bf038d20
5e20: 00000076 bf0da06c cfa05f58 c0008860 00100100 00200200 c05c4370 c05cf004
5e40: c05a0840 cfdda058 fffffffe c05c4320 00000000 0000000f cffd26e0 00000000
5e60: 00000000 00000001 cffd26e0 00000000 c05c4320 00000001 cfb00000 00000124
5e80: 00000124 cfa05f58 00000001 bf0bc2a8 bf0bc29c cfb273c0 00000001 cfb273e4
5ea0: bf0bc2e4 c00579c0 bf0bc2a8 00007fff c0054cdc cf87b0c0 cfb08940 00000000
5ec0: d08d8000 00000000 bf0bc2a8 cfb273c8 cfa04028 00000000 cfa05ef4 cfa05f24
5ee0: cf998a40 000002d2 000000d2 c000e364 cfa04000 00000000 00000000 00000000
5f00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
5f20: 00000000 00000000 00000000 00000000 b6de9008 00123a73 b6de9008 000a9008
5f40: 00000080 c000e364 cfa04000 00000000 00000000 c0057d64 d08d8000 00123a73
5f60: d0995ee0 d0995d8e d09ebf60 000c1dc4 000ce3c4 00000000 00000000 00000000
5f80: 00000020 00000021 00000016 00000000 0000000a 00000000 beb27eaa b6de9008
5fa0: 000a9008 c000e1e0 beb27eaa b6de9008 b6de9008 00123a73 000a9008 00000000
5fc0: beb27eaa b6de9008 000a9008 00000080 000a7678 00081ae0 0000000b 00000000
5fe0: b6f17db4 beb27b5c 0001b964 b6f17dc4 a0000010 b6de9008 d5ffd7ff e7fe7fff
[<bf0389bc>] (rtw_ndev_notifier_call [8188eu]) from [<c0304180>] (register_netdevice_notifier+0x7c/0x19c)
[<c0304180>] (register_netdevice_notifier) from [<bf038d20>] (rtw_ndev_notifier_register+0x10/0x14 [8188eu])
[<bf038d20>] (rtw_ndev_notifier_register [8188eu]) from [<bf0da06c>] (rtw_drv_entry+0x6c/0xd8 [8188eu])
[<bf0da06c>] (rtw_drv_entry [8188eu]) from [<c0008860>] (do_one_initcall+0xf8/0x144)
[<c0008860>] (do_one_initcall) from [<c00579c0>] (load_module+0x1af0/0x1db8)
[<c00579c0>] (load_module) from [<c0057d64>] (SyS_init_module+0xdc/0xf0)
[<c0057d64>] (SyS_init_module) from [<c000e1e0>] (ret_fast_syscall+0x0/0x30)
Code: e1a04002 e5922118 e309c910 e34bcf04 (e5922028) 
---[ end trace 4eb0cd336b51065a ]---
Segmentation fault

解决方法:

在驱动目录里查找driver中rtw_ndev_notifier_call 函数,在os_dep/linux/os_intfs.c中,

static int rtw_ndev_notifier_call(struct notifier_block * nb, unsigned long state, void *ndev)
{

#if (LINUX_VERSION_CODE>=KERNEL_VERSION(3,11,0))

   struct net_device *dev = netdev_notifier_info_to_dev(ndev);

#else

   struct net_device *dev = ndev;

#endif

#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
if (dev->netdev_ops->ndo_do_ioctl != rtw_ioctl)
#else
if (dev->do_ioctl != rtw_ioctl)
#endif
return NOTIFY_DONE;
DBG_871X_LEVEL(_drv_info_, FUNC_NDEV_FMT" state:%lu\n", FUNC_NDEV_ARG(dev), state);
switch (state) {
case NETDEV_CHANGENAME:
rtw_adapter_proc_replace(dev);
break;
}
return NOTIFY_DONE;
}
 
修改下重新编译,加载到内核。段错误消失。

你可能感兴趣的:([置顶] 关于加载驱动rtl8188EUS(8188eu.ko)到内核3.15出现段错误)