mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list@gmail.com>
To: Rob Herring <robh@kernel.org>
Cc: pantelis.antoniou@konsulko.com,
	Pantelis Antoniou <panto@antoniou-consulting.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	geert@linux-m68k.org
Subject: Re: [PATCH v3 4/4] of: improve reporting invalid overlay target path
Date: Sun, 18 Feb 2018 22:30:40 -0800	[thread overview]
Message-ID: <b2bd1af4-1231-23d9-fd89-ad45d49d8257@gmail.com> (raw)
In-Reply-To: <20180219032141.lapcr32f4zqulvvb@rob-hp-laptop>

On 02/18/18 19:21, Rob Herring wrote:
> On Wed, Feb 14, 2018 at 09:35:46PM -0800, frowand.list@gmail.com wrote:
>> From: Frank Rowand <frank.rowand@sony.com>
>>
>> Errors while developing the patch to create of_overlay_fdt_apply()
>> exposed inadequate error messages to debug problems when overlay
>> devicetree fragment nodes contain an invalid target path.  Improve
>> the messages in find_target_node() to remedy this.
>>
>> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
>> ---
>>
>> changes from v2:
>>   - add fragment node name as suggested by Geert
>>   - existing error message printed short node name, thus not
>>     discriminating between fragments; change to full node name
>>   - existing error message printed node address, which is devicetree
>>     internal debugging, not useful in an overlay apply error message;
>>     remove node address from message
>>
>>  drivers/of/overlay.c | 22 ++++++++++++++++------
>>  1 file changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
>> index 5f6c5569e97d..852e566d7744 100644
>> --- a/drivers/of/overlay.c
>> +++ b/drivers/of/overlay.c
>> @@ -488,20 +488,30 @@ static int build_changeset(struct overlay_changeset *ovcs)
>>   */
>>  static struct device_node *find_target_node(struct device_node *info_node)
>>  {
>> +	struct device_node *node;
>>  	const char *path;
>>  	u32 val;
>>  	int ret;
>>  
>>  	ret = of_property_read_u32(info_node, "target", &val);
>> -	if (!ret)
>> -		return of_find_node_by_phandle(val);
>> +	if (!ret) {
>> +		node = of_find_node_by_phandle(val);
>> +		if (!node)
>> +			pr_err("find target, node: %pOF, phandle 0x%x not found\n",
> 
> I'm wondering if the core should print the error rather than having all 
> the callers do it. The question is whether there are cases where failing 
> is okay? I guess sometimes we use 0 to skip cells, but the core handle 
> not printing an error in that case.

find_target_node() is overlay specific, and is only called from one location
in overlay.c.

There are no cases where failing is ok.  This is used to find the target
node that an overlay fragment is being applied to.  If it fails then
either the base devicetree or the overlay devicetree has an error.

-Frank


> Rob
> 
>> +			       info_node, val);
>> +		return node;
>> +	}
>>  
>>  	ret = of_property_read_string(info_node, "target-path", &path);
>> -	if (!ret)
>> -		return of_find_node_by_path(path);
>> +	if (!ret) {
>> +		node =  of_find_node_by_path(path);
>> +		if (!node)
>> +			pr_err("find target, node: %pOF, path '%s' not found\n",
>> +			       info_node, path);
>> +		return node;
>> +	}
>>  
>> -	pr_err("Failed to find target for node %p (%s)\n",
>> -		info_node, info_node->name);
>> +	pr_err("find target, node: %pOF, no target property\n", info_node);
>>  
>>  	return NULL;
>>  }
>> -- 
>> Frank Rowand <frank.rowand@sony.com>
>>
> 

      reply	other threads:[~2018-02-19  6:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15  5:35 [PATCH v3 0/4] of: change overlay apply input data from unflattened frowand.list
2018-02-15  5:35 ` [PATCH v3 1/4] of: change overlay apply input data from unflattened to FDT frowand.list
2018-02-18  2:24   ` kbuild test robot
2018-02-15  5:35 ` [PATCH v3 2/4] of: Documentation: of_overlay_apply() replaced by of_overlay_fdt_apply() frowand.list
2018-02-15  5:35 ` [PATCH v3 3/4] of: convert unittest overlay devicetree source to sugar syntax frowand.list
2018-02-15  5:35 ` [PATCH v3 4/4] of: improve reporting invalid overlay target path frowand.list
2018-02-19  3:21   ` Rob Herring
2018-02-19  6:30     ` Frank Rowand [this message]

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=b2bd1af4-1231-23d9-fd89-ad45d49d8257@gmail.com \
    --to=frowand.list@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=panto@antoniou-consulting.com \
    --cc=robh@kernel.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®