All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 13/16] regulator: mc13xxx: Use of_get_child_by_name
@ 2014-02-24 13:44 Philippe Rétornaz
  2014-02-24 14:51 ` Sachin Kamat
  0 siblings, 1 reply; 9+ messages in thread
From: Philippe Rétornaz @ 2014-02-24 13:44 UTC (permalink / raw)
  To: Sachin Kamat, Mark Brown; +Cc: linux-kernel, lgirdwood

Hi

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>] 
(of_get_child_by_name+0x38/0x50)
[    0.881449] [<c02f5420>] (of_get_child_by_name) from [<c01f6258>] 
(mc13xxx_get_num_regulators_dt+0x18/0x64)
[    0.882707] [<c01f6258>] (mc13xxx_get_num_regulators_dt) from 
[<c01f5d38>] (mc13783_regulator_probe+0x34/0x17c)
[    0.884011] [<c01f5d38>] (mc13783_regulator_probe) from [<c021fed0>] 
(platform_drv_probe+0x20/0x54)
[    0.885182] [<c021fed0>] (platform_drv_probe) from [<c021e674>] 
(driver_probe_device+0x144/0x360)
(...)

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 
argument.

So please revert this patch.

Regards,

Philippe


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-25 11:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-24 13:44 [PATCH 13/16] regulator: mc13xxx: Use of_get_child_by_name Philippe Rétornaz
2014-02-24 14:51 ` Sachin Kamat
2014-02-24 15:07   ` Philippe Rétornaz
2014-02-24 15:10     ` Sachin Kamat
2014-02-25  8:47       ` [PATCH 1/1] regulator: mc13xxx: check if DT is enabled Philippe Rétornaz
2014-02-25  9:12         ` Sachin Kamat
2014-02-25 10:09           ` Philippe Rétornaz
2014-02-25 10:12             ` Sachin Kamat
2014-02-25 11:58         ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.