mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Philippe Rétornaz" <philippe.retornaz@epfl.ch>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Mark Brown <broonie@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH 13/16] regulator: mc13xxx: Use of_get_child_by_name
Date: Mon, 24 Feb 2014 16:07:15 +0100	[thread overview]
Message-ID: <530B6023.5020400@epfl.ch> (raw)
In-Reply-To: <CAK9yfHy+ZNtY1bsiupyhf7LTPkAUSntB5O7sqgt7Lk+B2EowZg@mail.gmail.com>

Le 24/02/2014 15:51, Sachin Kamat a écrit :
> On 24 February 2014 19:14, Philippe Rétornaz
> <philippe.retornaz@epfl.ch> wrote:
>> 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.
>
> Sorry for the issue caused due to this patch. I would prefer to try
> to have this fixed before reverting. Can you please try with below
> change and let me know if it works:
>
> parent = of_get_child_by_name(pdev->dev->of_node, "regulators");
>

You meant pdev->dev.of_node here I guess ?
This still OOPS as the board is not booting with DT, so all of_node are
NULL.

> Also, how about adding NULL check to see it the node exists at all?
>

Could be an option. BTW, mc13xxx_parse_regulators_dt() has the same problem.

Regards,

Philippe




  reply	other threads:[~2014-02-24 15:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24 13:44 Philippe Rétornaz
2014-02-24 14:51 ` Sachin Kamat
2014-02-24 15:07   ` Philippe Rétornaz [this message]
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=530B6023.5020400@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®