Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1609098

[RFC PATCH 3/3] of: fix node traversing in of_dma_get_range

From Oza Pawandeep <oza.oza@broadcom.com>
Newsgroups linux.kernel
Subject [RFC PATCH 3/3] of: fix node traversing in of_dma_get_range
Date 2017-03-25 06:40 +0100
Message-ID <toMAF-4Hq-11@gated-at.bofh.it> (permalink)
References <toMAF-4Hq-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


it jumps to the parent node without examining the child node.
also with that, it throws "no dma-ranges found for node"
for pci dma-ranges.

this patch fixes device node traversing for dma-ranges.

Reviewed-by: Anup Patel <anup.patel@broadcom.com>
Signed-off-by: Oza Pawandeep <oza.oza@broadcom.com>

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 02b2903..3293d55 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -836,9 +836,6 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
 	while (1) {
 		naddr = of_n_addr_cells(node);
 		nsize = of_n_size_cells(node);
-		node = of_get_next_parent(node);
-		if (!node)
-			break;
 
 		ranges = of_get_property(node, "dma-ranges", &len);
 
@@ -852,6 +849,10 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
 		 */
 		if (!ranges)
 			break;
+
+		node = of_get_next_parent(node);
+		if (!node)
+			break;
 	}
 
 	if (!ranges) {
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 1/3] of/pci: dma-ranges to account highest possible host bridge dma_mask Oza Pawandeep <oza.oza@broadcom.com> - 2017-03-25 06:40 +0100
  [RFC PATCH 3/3] of: fix node traversing in of_dma_get_range Oza Pawandeep <oza.oza@broadcom.com> - 2017-03-25 06:40 +0100
    Re: [RFC PATCH 3/3] of: fix node traversing in of_dma_get_range Rob Herring <robh@kernel.org> - 2017-03-27 16:40 +0200
      Re: [RFC PATCH 3/3] of: fix node traversing in of_dma_get_range Robin Murphy <robin.murphy@arm.com> - 2017-03-27 16:50 +0200
  Re: [RFC PATCH 1/3] of/pci: dma-ranges to account highest possible  host bridge dma_mask Rob Herring <robh@kernel.org> - 2017-03-27 17:20 +0200

csiph-web