current-speed property in serial devices causes kernel panic
Kumar Gala
galak at kernel.crashing.org
Tue Jul 3 02:46:41 EST 2007
On Jun 29, 2007, at 11:26 PM, Timur Tabi wrote:
> I see this code in function of_platform_serial_setup():
>
> static int __devinit of_platform_serial_setup(struct of_device *ofdev,
> int type, struct uart_port
> *port)
> {
> struct resource resource;
> struct device_node *np = ofdev->node;
> const unsigned int *clk, *spd;
> int ret;
>
> memset(port, 0, sizeof *port);
> spd = of_get_property(np, "current-speed", NULL);
> ...
> port->custom_divisor = *clk / (16 * (*spd));
>
> return 0;
> }
>
> There is no check in this code to make sure spd is not null. And
> sure enough, in most DTS files, current-speed does not exist. So
> whenever this function is called on a node like this, the kernel
> panics.
I'm wondering why we set port->custom_divisor instead of setting port-
>speed. (plus the null check).
- k
More information about the Linuxppc-dev
mailing list