[U-Boot] [PATCH] core: of_addr: Correct the size type of of_get_address to fdt_size_t

Keerthy j-keerthy at ti.com
Wed Aug 14 10:26:48 UTC 2019


Currently the size parameter is defined as u64 type.
Correct the size type of of_get_address to fdt_size_t
so that both 64 bit and 32 bit architectures are taken
care of.

The initial bug report:
https://patchwork.ozlabs.org/patch/1090094/#2212555

Fixes: e679d03b08fb ("core: ofnode: Add ofnode_get_addr_size_index")
Reported-by: Eugeniu Rosca <rosca.eugeniu at gmail.com>
Tested-by: Eugeniu Rosca <rosca.eugeniu at gmail.com> 
Signed-off-by: Keerthy <j-keerthy at ti.com>
---

Changes from RFT:

  * Fixed a typo in the commit log.
  * Added Reported-by: Eugeniu Rosca <rosca.eugeniu at gmail.com>
	  Tested-by: Eugeniu Rosca <rosca.eugeniu at gmail.com>

 drivers/core/of_addr.c | 4 ++--
 drivers/core/ofnode.c  | 2 +-
 include/dm/of_addr.h   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c
index 4e256d9926..812a400b19 100644
--- a/drivers/core/of_addr.c
+++ b/drivers/core/of_addr.c
@@ -122,7 +122,7 @@ static void dev_count_cells(const struct device_node *np, int *nap, int *nsp)
 }
 
 const __be32 *of_get_address(const struct device_node *dev, int index,
-			     u64 *size, unsigned int *flags)
+			     fdt_size_t *size, unsigned int *flags)
 {
 	const __be32 *prop;
 	int psize;
@@ -347,7 +347,7 @@ int of_address_to_resource(const struct device_node *dev, int index,
 			   struct resource *r)
 {
 	const __be32	*addrp;
-	u64		size;
+	fdt_size_t	size;
 	unsigned int	flags;
 	const char	*name = NULL;
 
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 2ac73af934..b21b5183a3 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -260,7 +260,7 @@ fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size)
 		uint flags;
 
 		prop_val = of_get_address(ofnode_to_np(node), index,
-					  (u64 *)size, &flags);
+					  size, &flags);
 		if (!prop_val)
 			return FDT_ADDR_T_NONE;
 
diff --git a/include/dm/of_addr.h b/include/dm/of_addr.h
index 3fa1ffce81..52443ef296 100644
--- a/include/dm/of_addr.h
+++ b/include/dm/of_addr.h
@@ -58,7 +58,7 @@ u64 of_translate_dma_address(const struct device_node *no, const __be32 *in_addr
  * @return pointer to address which can be read
  */
 const __be32 *of_get_address(const struct device_node *no, int index,
-			     u64 *size, unsigned int *flags);
+			     fdt_size_t *size, unsigned int *flags);
 
 struct resource;
 
-- 
2.17.1



More information about the U-Boot mailing list