Message ID | 1410451272-31068-1-git-send-email-bigeasy@linutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 09/11/2014 11:01 AM, Sebastian Andrzej Siewior wrote: > I "forgot" to update the dtb and the kernel crashed: > |Unable to handle kernel NULL pointer dereference at virtual address 0000002e > |PC is at __clk_get_flags+0x4/0xc > |LR is at ti_dt_clockdomains_setup+0x70/0xe8 > > because I did not have the clock nodes. of_clk_get() returns an error > pointer which is not checked here. > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > --- > drivers/clk/ti/clockdomain.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c > index f1e0038d76ac..fdd458600c2c 100644 > --- a/drivers/clk/ti/clockdomain.c > +++ b/drivers/clk/ti/clockdomain.c > @@ -36,6 +36,11 @@ static void __init of_ti_clockdomain_setup(struct device_node *node) > > for (i = 0; i < num_clks; i++) { > clk = of_clk_get(node, i); > + if (IS_ERR(clk)) { > + pr_err("Failed get %s' clock nr %d (%ld)\n", > + node->full_name, i, PTR_ERR(clk)); Could you add %s: __func__ as well - it kinda helps understand this is part of clockdomain setup and not some driver cribbing that it did not get some clock. > + continue; > + } > if (__clk_get_flags(clk) & CLK_IS_BASIC) { > pr_warn("can't setup clkdm for basic clk %s\n", > __clk_get_name(clk)); > -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c index f1e0038d76ac..fdd458600c2c 100644 --- a/drivers/clk/ti/clockdomain.c +++ b/drivers/clk/ti/clockdomain.c @@ -36,6 +36,11 @@ static void __init of_ti_clockdomain_setup(struct device_node *node) for (i = 0; i < num_clks; i++) { clk = of_clk_get(node, i); + if (IS_ERR(clk)) { + pr_err("Failed get %s' clock nr %d (%ld)\n", + node->full_name, i, PTR_ERR(clk)); + continue; + } if (__clk_get_flags(clk) & CLK_IS_BASIC) { pr_warn("can't setup clkdm for basic clk %s\n", __clk_get_name(clk));
I "forgot" to update the dtb and the kernel crashed: |Unable to handle kernel NULL pointer dereference at virtual address 0000002e |PC is at __clk_get_flags+0x4/0xc |LR is at ti_dt_clockdomains_setup+0x70/0xe8 because I did not have the clock nodes. of_clk_get() returns an error pointer which is not checked here. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- drivers/clk/ti/clockdomain.c | 5 +++++ 1 file changed, 5 insertions(+)