linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: linuxppc-dev list <linuxppc-dev@ozlabs.org>
Subject: current-speed property in serial devices causes kernel panic
Date: Fri, 29 Jun 2007 23:26:11 -0500	[thread overview]
Message-ID: <4685DB63.7040705@freescale.com> (raw)

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 adding support for a new 86xx platform, and I'm also creating a driver for a new SOC device.  In my platform driver, I have this code:

static struct of_device_id mpc86xx_ids[] = {
        { .type = "soc", },
        {}
};
   
static int __init mpc86xx_declare_of_platform_devices(void)  
{
        printk(KERN_ALERT "%s\n", __FUNCTION__);

        if (!machine_is(mpc86xx_hpcn))
                return 0;

        of_platform_bus_probe(NULL, mpc86xx_ids, NULL);

        return 0;
}
device_initcall(mpc86xx_declare_of_platform_devices);

The kernel panic occurs only if I call of_platform_bus_probe().

If you look at the code for the 836x platform, you'll see that it also has serial SOC devices and it also calls of_platform_bus_probe(), but it doesn't experience kernel panics.

Is the call to of_platform_bus_probe() effectively trying to probe the serial devices twice?  I just don't understand why this code isn't working.

             reply	other threads:[~2007-06-30  4:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-30  4:26 Timur Tabi [this message]
2007-07-02 16:46 ` current-speed property in serial devices causes kernel panic Kumar Gala
2007-07-02 20:01 ` Timur Tabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4685DB63.7040705@freescale.com \
    --to=timur@freescale.com \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).