GPIO driver module for Jetway NF98 board

Joan Pau Beltran joanpau.beltran at uib.cat
Mon Jan 23 16:00:44 EST 2012


Now that the code compiles, I need some help to debug it.
I used the kernel headers shipped with my distribution (Ubuntu), namely 
(from uname -r)
   2.6.38-13-generic

Everything compiles fine, without any warning.

But calling insmod, immediately triggers this error (from dmesg):

[  798.129707] generic-usb 0003:413C:2101.0002: input,hidraw0: USB HID 
v1.11 Keyboard [Dell Dell Smart Card Reader Keyboard] on 
usb-0000:00:1a.0-1.2/input0
[ 1414.832761] BUG: unable to handle kernel NULL pointer dereference at 
0000000000000502
[ 1414.832880] IP: [<ffffffffa00300e4>] jwnf98_gpio_init+0xe4/0x1000 
[gpio_jwnf98]
[ 1414.832982] PGD 20a704067 PUD 21a601067 PMD 0
[ 1414.833036] Oops: 0000 [#1] SMP
[ 1414.833077] last sysfs file: 
/sys/devices/pci0000:00/0000:00:19.0/net/eth0/statistics/collisions
[ 1414.833152] CPU 3
[ 1414.833172] Modules linked in: gpio_jwnf98(+) btrfs zlib_deflate 
libcrc32c ufs qnx4 hfsplus hfs minix ntfs vfat msdos fat jfs xfs 
exportfs reiserfs ppdev snd_hda_codec_hdmi snd_hda_codec_via 
snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_midi snd_rawmidi 
snd_seq_midi_event lm78 hwmon_vid snd_seq snd_timer snd_seq_device i915 
drm_kms_helper psmouse drm i2c_algo_bit snd video soundcore 
snd_page_alloc serio_raw lp parport intel_ips usbhid hid firewire_ohci 
e1000e firewire_core crc_itu_t
[ 1414.833725]
[ 1414.833744] Pid: 28764, comm: insmod Not tainted 2.6.38-13-generic 
#54~lucid1-Ubuntu To be filled by O.E.M. To be filled by O.E.M./To be 
filled by O.E.M.
[ 1414.833877] RIP: 0010:[<ffffffffa00300e4>]  [<ffffffffa00300e4>] 
jwnf98_gpio_init+0xe4/0x1000 [gpio_jwnf98]
[ 1414.833965] RSP: 0018:ffff880208adbf18  EFLAGS: 00010206
[ 1414.834011] RAX: ffff8801e8e8f900 RBX: ffffffffa04cf080 RCX: 
ffff8801e8e8f328
[ 1414.834071] RDX: 0000000000000538 RSI: 0000000000000538 RDI: 
ffffffff81a19438
[ 1414.834131] RBP: ffff880208adbf18 R08: 0000000000000000 R09: 
ffff8801e8e8f900
[ 1414.834191] R10: 0000000000000004 R11: 0000000000000001 R12: 
0000000000000000
[ 1414.834251] R13: ffffffffa0030000 R14: 0000000000000003 R15: 
0000000000004000
[ 1414.834312] FS:  00007fbb2f5a5700(0000) GS:ffff8800cb380000(0000) 
knlGS:0000000000000000
[ 1414.834380] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1414.834430] CR2: 0000000000000502 CR3: 00000002089b2000 CR4: 
00000000000006e0
[ 1414.834490] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[ 1414.834549] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 
0000000000000400
[ 1414.834610] Process insmod (pid: 28764, threadinfo ffff880208ada000, 
task ffff88021bad16e0)
[ 1414.834678] Stack:
[ 1414.834698]  ffff880208adbf48 ffffffff81002053 ffffffffa04cf080 
0000000000000000
[ 1414.834775]  00000000024a7010 0000000000000003 ffff880208adbf78 
ffffffff810a3d4b
[ 1414.834851]  00007fff75d0d9da 00007fff75d0d9da 00000000024a7030 
00000000000019db
[ 1414.834927] Call Trace:
[ 1414.834958]  [<ffffffff81002053>] do_one_initcall+0x43/0x190
[ 1414.835011]  [<ffffffff810a3d4b>] sys_init_module+0xfb/0x250
[ 1414.835062]  [<ffffffff8100c082>] system_call_fastpath+0x16/0x1b
[ 1414.835114] Code: c7 c7 c0 93 a1 81 e8 5c d8 03 e1 45 31 c0 48 c7 c1 
24 e0 4c a0 ba 01 00 00 00 be 38 05 00 00 48 c7 c7 c0 93 a1 81 e8 3c d8 
03 e1 <8a> 04 25 02 05 00 00 48 c7 c7 00 f0 4c a0 83 c8 20 88 04 25 02
[ 1414.842138] RIP  [<ffffffffa00300e4>] jwnf98_gpio_init+0xe4/0x1000 
[gpio_jwnf98]
[ 1414.845597]  RSP <ffff880208adbf18>
[ 1414.849064] CR2: 0000000000000502
[ 1414.921662] ---[ end trace d6d694e0e28fc4ad ]---

I am not aware of any pointer dereference in the code, so it is dificult 
to me
to figure out what is wrong.

Fortunately, the system does not become unresponsive (what a nice 
kernel!!!).
The gpio_jwnf98 is listed in lsmod,
but no chip directory appears under /sys/class/gpio.

Finally, the module can not be removed, rmmod outputs:

ERROR: Module gpio_jwnf98 is in use

Thanks again for all the help.

-- 
Joan Pau Beltran




More information about the Kernelnewbies mailing list