Subject: Re: Oops: of_platform_serial_probe

From: Arnd Bergmann <[email-masked]>
Date: Mon, 19 Nov 2007 17:56:54 +0100

On Monday 19 November 2007, Clemens Koller wrote:
> Unable to handle kernel paging request for data at address 0x00000000
> Faulting instruction address: 0xc018f03c
> Oops: Kernel access of bad area, sig: 11 [#1]
> MPC85xx ADS
> Modules linked in:
> NIP: c018f03c LR: c018f00c CTR: c00127b4
> REGS: c0821cf0 TRAP: 0300   Not tainted  (2.6.24-rc2-ge6a5c27f)
> MSR: 00029000 <EE,ME>  CR: 42022088  XER: 20000000
> DEAR: 00000000, ESR: 00000000
> TASK = c081e000[1] 'swapper' THREAD: c0820000
> GPR00: b1000000 c0821da0 c081e000 c0833e10 00000004 c0821d80 c03d3064 c05eea80
> GPR08: 00000200 00000002 0000002a 13ab6680 82022042 00000000 c03318a4 c033188c
> GPR16: c0331908 c03318f0 c03a0e30 c0331930 c033191c 007fff00 0ffeccbc c03a0000
> GPR24: c0821dc4 00000000 00000003 c0934cf8 cffffba8 00000000 c0833e00 c07fdc6c
> NIP [c018f03c] of_platform_serial_probe+0x118/0x1e4
> LR [c018f00c] of_platform_serial_probe+0xe8/0x1e4
> Call Trace:

Ok, that is a NULL pointer access, probably somewhere in the
of_platform_serial_setup that can be inlined. Please post the
device tree entries for your serial ports so we can see what
goes wrong there.

One potential problem that I can see is a missing 'current-speed'
property in your tree, which would cause this behavior. It looks
like many device trees set this, but it is not required by all
bindings. If that's the case, the patch below should fix your
problem, but you probably want to set the current-speed anyway,
according to your boot loader settings.

	Arnd <><

--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -56,7 +56,8 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
 	port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
 		| UPF_FIXED_PORT;
 	port->dev = &ofdev->dev;
-	port->custom_divisor = *clk / (16 * (*spd));
+	if (spd)
+		port->custom_divisor = *clk / (16 * (*spd));

 	return 0;
 }