Kernel Oops on device_create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

I don't know why I get a kernel oops when calling device_create in the
following code.

It works on my computer 2.6.27, i386 but not on the computer where it
should run: arm 2.6.22. As I understand from the oops it's something
about the file_name, but I don't get it.

Code:

    /* Registering device */
    cdev_init(&si_fpga_cdev, &si_fpga_fops);
    si_fpga_cdev.owner = THIS_MODULE;
    result = cdev_add(&si_fpga_cdev, dev, 1);

    if (result < 0) {
        err("cannot obtain major number: %d", si_fpga_major);
        return result;
    }

    /* Create a class of devices */
    si_fpga_class = class_create(THIS_MODULE, MODNAME);
    if (IS_ERR(si_fpga_class)) {
        err("cannot make si_fpga_class");
        result = PTR_ERR(si_fpga_class);
        goto fail_reg;
    }

    /* Create file in udev */
    device_create(si_fpga_class, NULL, dev, NULL, SI_FPGA_DEV_NAME);

Oops:

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c349c000
[00000000] *pgd=23850031, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1]
Modules linked in: si_fpga
CPU: 0    Not tainted  (2.6.22 #7)
PC is at vsnprintf+0x578/0x5c8
LR is at device_create+0x78/0xb4
pc : [<c0109f7c>]    lr : [<c012c698>]    psr: 80000013
sp : c3af7e48  ip : c3af7e98  fp : c3af7e94
r10: c4865000  r9 : c3fd82b8  r8 : 03c00000
r7 : c3af7ec8  r6 : c3fd82a4  r5 : c0019160  r4 : c3fd8200
r3 : 00000000  r2 : 00000000  r1 : 00000014  r0 : c3fd82a4
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  Segment user
Control: 0005317f  Table: 2349c000  DAC: 00000015
Process insmod (pid: 1204, stack limit = 0xc3af6260)
Stack: (0xc3af7e48 to 0xc3af8000)
7e40:                   c3af7eb4 c3af7e58 c002c3d0 c002c1e0 c01058b4
00000014
7e60: c3fd82a4 00000000 bf000d04 c3fd8200 c0019160 03c00000 00000000
03c00000
7e80: 00000012 c4865000 c3af7ec0 c3af7e98 c012c698 c0109a14 c003a430
c3af7ec8
7ea0: 03c00000 bf000440 bf000f00 bf000d80 bf000d04 c3af7ef4 c3af7ec8
bf000368
7ec0: c012c634 00000000 bf000440 c3ce856c c3af7ef4 c3ce854c c3ce8400
bf000d80
7ee0: c3ce856c 00000012 c3af7fa4 c3af7ef8 c005798c bf00022c 00000000
c3af7f08
7f00: c008d5bc 00000000 00000000 00000000 00000000 00000000 00000000
00000000
7f20: 00000000 00000000 00000000 00000000 00000000 00000003 c4866404
c397f320
7f40: 00000000 c4865d0c c4865bf4 00000005 00000000 00000045 00000045
c48659ea
7f60: c4865d5c bf000d8cc4865d34 00000010 00000000 00000000 c3958e60 00000160
7f80: 00000003 00012018 00000080 c0024f88 c3af6000 00000000 00000000
c3af7fa8
7fa0: c0024de0 c005676c 00000160 00000003 00012018 00001655 00012008
00000073
7fc0: 00000160 00000003 00012018 00000080 beee0ef3 00000000 00012008
00000000
7fe0: 00004000 beee0ca4 00008e0c 400cadc4 60000010 00012018 00000000
00000000
Backtrace:
[<c0109a04>] (vsnprintf+0x0/0x5c8) from [<c012c698>]
(device_create+0x78/0xb4)
[<c012c624>] (device_create+0x4/0xb4) from [<bf000368>]
(init_module+0x14c/0x1f)
 r7:bf000d04 r6:bf000d80 r5:bf000f00 r4:bf000440
[<bf00021c>] (init_module+0x0/0x1f8 [si_fpga]) from [<c005798c>]
(sys_init_modu)
 r8:00000012 r7:c3ce856c r6:bf000d80 r5:c3ce8400 r4:c3ce854c
[<c005675c>] (sys_init_module+0x0/0x12e8) from [<c0024de0>]
(ret_fast_syscall+0)
Code: e51b3030 e2833001 e50b3030 e51b3030 (e5d33000)
Segmentation fault

Any hints?

Bye...Frank

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux