|
HI Sir I have such code in atmel_serial.c.
static ssize_t dump_port_status(struct device *dev,struct device_attribute *attr,char *buf) { /*Function in ldisc*/ struct platform_device *pdev = to_platform_device (dev);
struct uart_port *port = (struct uart_port *) &atmel_ports[pdev->id]; printk("Port:Irq:%d\n",port->irq); struct tty_struct *tty = port->info->port.tty; printk("Port:ID:%d\n",tty->index); return 0;
}
DEVICE_ATTR (port_status, S_IRUGO | S_IWUSR, dump_port_status, NULL);
and then I create an node in system by device_create_file(&pdev->dev, &dev_attr_port_status); in probe function. But I found NULL point Error when Cat /sys/bus/platform/devices/atmel_usart.1/
Error like ort:Irq:6 Unable to handle kernel NULL pointer dereference at virtual address 00000010 pgd = c1c50000 [00000010] *pgd=21d10031, *pte=00000000, *ppte=00000000 Internal error: Oops: 17 [#1] PREEMPT Modules linked in: (xxxxxxxxxxx)<-----------I changed this part for xxx reasons :) CPU: 0 Not tainted (2.6.30.10 #179) PC is at dump_port_status+0x38/0x54 [IB2hw] LR is at release_console_sem+0x1e4/0x228 pc : [<bf009428>] lr : [<c003df4c>] psr: 60000013 sp : c1c49ee0 ip : c1c49e00 fp : c1c49ef4 r10: c1547a18 r9 : c1c48000 r8 : c1c49f78 r7 : c031aa48 r6 : c1540c60 r5 : bf00d460 r4 : bf00da50 r3 : 00000000 r2 : c1c4a098 r1 : c1c48000 r0 : bf00b724 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 0005317f Table: 21c50000 DAC: 00000015 Process cat (pid: 444, stack limit = 0xc1c48268) Stack: (0xc1c49ee0 to 0xc1c4a000) 9ee0: bf00d3b4 bf00d460 c1c49f0c c1c49ef8 c0189690 bf009400 c1547a00 bf00d460 9f00: c1c49f4c c1c49f10 c00e1ba8 c0189678 c153c900 00000003 00001000 bece8930 9f20: 00000000 c1ce9b80 bece8930 c1c49f78 00001000 c0025fe8 c1c48000 00000000 9f40: c1c49f74 c1c49f50 c0097e88 c00e1b1c 00000020 c181d980 00000000 00000000 9f60: c1ce9b80 00000003 c1c49fa4 c1c49f78 c00982e8 c0097ddc 00000000 00000000 9f80: c0025fe8 00000000 c1c49fa4 00001000 bece8930 00000003 00000000 c1c49fa8 9fa0: c0025e40 c00982b4 00001000 bece8930 00000003 bece8930 00001000 00000001 9fc0: 00001000 bece8930 00000003 00000003 00000000 bece8930 00000001 00000003 9fe0: 0017ccdc bece8910 000aeb78 00008e0c 60000010 00000003 e5921430 e3a03001 Backtrace: [<bf0093f0>] (dump_port_status+0x0/0x54 [IB2hw]) from [<c0189690>] (dev_attr_show+0x28/0x54) r5:bf00d460 r4:bf00d3b4 [<c0189668>] (dev_attr_show+0x0/0x54) from [<c00e1ba8>] (sysfs_read_file+0x9c/0x138) r5:bf00d460 r4:c1547a00 [<c00e1b0c>] (sysfs_read_file+0x0/0x138) from [<c0097e88>] (vfs_read+0xbc/0x154) [<c0097dcc>] (vfs_read+0x0/0x154) from [<c00982e8>] (sys_read+0x44/0x74) r7:00000003 r6:c1ce9b80 r5:00000000 r4:00000000 [<c00982a4>] (sys_read+0x0/0x74) from [<c0025e40>] (ret_fast_syscall+0x0/0x2c) r6:00000003 r5:bece8930 r4:00001000 Code: eb40d479 e5942028 e59f0018 e5923000 (e5931010) ---[ end trace 9a94eaf71262d0c7 ]--- Segmentation fault
Any suggestion will be appreciated.
|