From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-rpi-kernel@lists.infradead.org,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
Nathan Chancellor <natechancellor@gmail.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] of: address: Fix parser address/size cells initialization
Date: Fri, 31 Jul 2020 12:02:48 +0200 [thread overview]
Message-ID: <20200731100248.26982-1-nsaenzjulienne@suse.de> (raw)
bus->count_cells() parses cells starting from the node's parent. This is
not good enough for parser_init() which is generally parsing a bus node.
Revert to previous behavior using of_bus_n_*_cells().
Fixes: 2f96593ecc37 ("of_address: Add bus type match for pci ranges parser")
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
drivers/of/address.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 275d764efc77..89822e191956 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -701,11 +701,11 @@ static int parser_init(struct of_pci_range_parser *parser,
parser->node = node;
parser->pna = of_n_addr_cells(node);
+ parser->na = of_bus_n_addr_cells(node);
+ parser->ns = of_bus_n_size_cells(node);
parser->dma = !strcmp(name, "dma-ranges");
parser->bus = of_match_bus(node);
- parser->bus->count_cells(parser->node, &parser->na, &parser->ns);
-
parser->range = of_get_property(node, name, &rlen);
if (parser->range == NULL)
return -ENOENT;
--
2.27.0
next reply other threads:[~2020-07-31 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 10:02 Nicolas Saenz Julienne [this message]
2020-07-31 15:03 ` [PATCH] of: address: Fix parser address/size cells initialization Rob Herring
2020-08-03 14:25 ` [PATCH] of: unittest: Use bigger address cells to catch parser regressions Nicolas Saenz Julienne
2020-08-03 22:27 ` Rob Herring
2020-07-31 15:45 ` [PATCH] of: address: Fix parser address/size cells initialization Thomas Bogendoerfer
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=20200731100248.26982-1-nsaenzjulienne@suse.de \
--to=nsaenzjulienne@suse.de \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=natechancellor@gmail.com \
--cc=robh+dt@kernel.org \
--cc=tsbogend@alpha.franken.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).