Re: [PATCH 2/5] core: return FDT_ADDR_T_NONE from devfdt_get_addr_[size_]name() on errors

2023-10-13 Thread Simon Glass
On Wed, 27 Sept 2023 at 07:34, Matthias Schiffer
 wrote:
>
> Checking for the error cast to fdt_addr_t is rather awkward - IS_ERR()
> can be used, but it's not really made to be used on fdt_addr_t, which
> may not even be the same size as a native pointer.
>
> Most places in U-Boot only check for FDT_ADDR_T_NONE; let's adjust the
> error return to match the expectation.
>
> Signed-off-by: Matthias Schiffer 
> ---
>  drivers/core/fdtaddr.c | 4 ++--
>  include/dm/fdtaddr.h   | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: Simon Glass 

Applied to u-boot-dm, thanks!


Re: [PATCH 2/5] core: return FDT_ADDR_T_NONE from devfdt_get_addr_[size_]name() on errors

2023-10-01 Thread Simon Glass
On Wed, 27 Sept 2023 at 07:34, Matthias Schiffer
 wrote:
>
> Checking for the error cast to fdt_addr_t is rather awkward - IS_ERR()
> can be used, but it's not really made to be used on fdt_addr_t, which
> may not even be the same size as a native pointer.
>
> Most places in U-Boot only check for FDT_ADDR_T_NONE; let's adjust the
> error return to match the expectation.
>
> Signed-off-by: Matthias Schiffer 
> ---
>  drivers/core/fdtaddr.c | 4 ++--
>  include/dm/fdtaddr.h   | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: Simon Glass 


[PATCH 2/5] core: return FDT_ADDR_T_NONE from devfdt_get_addr_[size_]name() on errors

2023-09-27 Thread Matthias Schiffer
Checking for the error cast to fdt_addr_t is rather awkward - IS_ERR()
can be used, but it's not really made to be used on fdt_addr_t, which
may not even be the same size as a native pointer.

Most places in U-Boot only check for FDT_ADDR_T_NONE; let's adjust the
error return to match the expectation.

Signed-off-by: Matthias Schiffer 
---
 drivers/core/fdtaddr.c | 4 ++--
 include/dm/fdtaddr.h   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 546db675aaf..426bb762754 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -145,7 +145,7 @@ fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, 
const char *name)
index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
  "reg-names", name);
if (index < 0)
-   return index;
+   return FDT_ADDR_T_NONE;
 
return devfdt_get_addr_index(dev, index);
 #else
@@ -162,7 +162,7 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice 
*dev,
index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
  "reg-names", name);
if (index < 0)
-   return index;
+   return FDT_ADDR_T_NONE;
 
return devfdt_get_addr_size_index(dev, index, size);
 #else
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index ca788dccb39..d3ad77faebf 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -142,7 +142,7 @@ void *devfdt_get_addr_size_index_ptr(const struct udevice 
*dev, int index,
  *   'reg-names' property providing named-based identification. @name
  *   indicates the value to search for in 'reg-names'.
  *
- * Return: addr
+ * Return: Address, or FDT_ADDR_T_NONE if there is no such property
  */
 fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name);
 
@@ -159,7 +159,7 @@ fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, 
const char *name);
  * @size: Pointer to size variable - this function returns the size
  *specified in the 'reg' property here
  *
- * Return: addr
+ * Return: Address, or FDT_ADDR_T_NONE if there is no such property
  */
 fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
 const char *name, fdt_size_t *size);
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/