All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Delaunay <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [PATCH 2/3] fdtdec: correct test on return of fdt_node_offset_by_phandle
Date: Fri, 25 Sep 2020 09:41:15 +0200	[thread overview]
Message-ID: <20200925074116.16068-2-patrick.delaunay@st.com> (raw)
In-Reply-To: <20200925074116.16068-1-patrick.delaunay@st.com>

The result of fdt_node_offset_by_phandle is negative for error,
so this patch corrects the check of this result in
fdtdec_parse_phandle_with_args.

This patch allows to have the same behavior with or without OF_LIVE
for the function dev_read_phandle_with_args with cell_name = NULL and
with invalid phandle.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 lib/fdtdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index d3b22ec323..90d7e50646 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -746,7 +746,7 @@ int fdtdec_parse_phandle_with_args(const void *blob, int src_node,
 			if (cells_name || cur_index == index) {
 				node = fdt_node_offset_by_phandle(blob,
 								  phandle);
-				if (!node) {
+				if (node < 0) {
 					debug("%s: could not find phandle\n",
 					      fdt_get_name(blob, src_node,
 							   NULL));
-- 
2.17.1

  reply	other threads:[~2020-09-25  7:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25  7:41 [PATCH 1/3] dm: add cells_count parameter in *_count_phandle_with_args Patrick Delaunay
2020-09-25  7:41 ` Patrick Delaunay [this message]
2020-10-05  1:42   ` [PATCH 2/3] fdtdec: correct test on return of fdt_node_offset_by_phandle Simon Glass
2020-10-05 21:32   ` Simon Glass
2020-09-25  7:41 ` [PATCH 3/3] test: dm: add test for phandle access functions Patrick Delaunay
2020-10-05  1:42   ` Simon Glass
2020-10-05 21:32   ` Simon Glass
2020-10-05  1:42 ` [PATCH 1/3] dm: add cells_count parameter in *_count_phandle_with_args Simon Glass

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=20200925074116.16068-2-patrick.delaunay@st.com \
    --to=patrick.delaunay@st.com \
    --cc=u-boot@lists.denx.de \
    /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.