All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Rétornaz" <philippe.retornaz@epfl.ch>
To: Sachin Kamat <sachin.kamat@linaro.org>, Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org, lgirdwood@gmail.com
Subject: Re: [PATCH 13/16] regulator: mc13xxx: Use of_get_child_by_name
Date: Mon, 24 Feb 2014 14:44:22 +0100	[thread overview]
Message-ID: <530B4CB6.9010608@epfl.ch> (raw)
In-Reply-To: 1392378602-32302-1-git-send-email-sachin.kamat@linaro.org

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


             reply	other threads:[~2014-02-24 13:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24 13:44 Philippe Rétornaz [this message]
2014-02-24 14:51 ` [PATCH 13/16] regulator: mc13xxx: Use of_get_child_by_name 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
  -- strict thread matches above, loose matches on Subject: below --
2014-02-14 11:49 [PATCH 01/16] regulator: max77686: Use of_get_child_by_name Sachin Kamat
2014-02-14 11:49 ` [PATCH 13/16] regulator: mc13xxx: " Sachin Kamat
2014-02-14 21:19   ` Mark Brown

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=530B4CB6.9010608@epfl.ch \
    --to=philippe.retornaz@epfl.ch \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sachin.kamat@linaro.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 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.