[lkml]   [2014]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 13/16] regulator: mc13xxx: Use of_get_child_by_name

This patch breaks DT-Enabled kernel run on non-DT board:
[ 0.822977] Unable to handle kernel NULL pointer dereference at
virtual address 0000001c
[ 0.880320] [<c02f3e94>] (of_get_next_child) from [<c02f5420>]
[ 0.881449] [<c02f5420>] (of_get_child_by_name) from [<c01f6258>]
[ 0.882707] [<c01f6258>] (mc13xxx_get_num_regulators_dt) from
[<c01f5d38>] (mc13783_regulator_probe+0x34/0x17c)
[ 0.884011] [<c01f5d38>] (mc13783_regulator_probe) from [<c021fed0>]
[ 0.885182] [<c021fed0>] (platform_drv_probe) from [<c021e674>]

Because mc13783-regulator do in its probe:
static int mc13783_regulator_probe(struct platform_device *pdev)
int i, num_regulators;

num_regulators = mc13xxx_get_num_regulators_dt(pdev);
if (num_regulators <= 0 && pdata)
num_regulators = pdata->num_regulators

and mc13xxx_get_num_regulators_dt() do, before your patch:

parent = of_find_node_by_name(pdev->dev.parent->of_node, "regulators");
if (!parent)
return -ENODEV;

of_find_node_by_name will return NULL if the node passed is NULL and the
DT is non-existant.

But, with your change we use this:
parent = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");

Which will OOPS as it does not expect to have a NULL node passed as

So please revert this patch.



 \ /
  Last update: 2014-02-24 15:41    [W:0.476 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site