From: Quentin Schulz <quentin.sch...@cherry.de> dev_read_u32_default is for getting a u32 from a Device Tree property and allows to take a default value if that property is missing.
Considering it calls ofnode_read_u32_default which takes a u32 and returns a u32, it should do the same instead of using an int, especially considering that int size is typically architecture-specific, as opposed to u32. This incidentally matches all other dev_read_*_default functions (except dev_read_s32_default which will be tackled in the next commit). Fixes: 47a0fd3bad38 ("dm: core: Implement live tree 'read' functions") Signed-off-by: Quentin Schulz <quentin.sch...@cherry.de> --- drivers/core/read.c | 4 ++-- include/dm/read.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/core/read.c b/drivers/core/read.c index 55c19f335ae12b8d9f83d1cb2a10e2ffc13cf935..981204bffe4c26641ea8b387f00f4efc641d6e47 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -38,8 +38,8 @@ int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp) return ofnode_read_u32(dev_ofnode(dev), propname, outp); } -int dev_read_u32_default(const struct udevice *dev, const char *propname, - int def) +u32 dev_read_u32_default(const struct udevice *dev, const char *propname, + u32 def) { return ofnode_read_u32_default(dev_ofnode(dev), propname, def); } diff --git a/include/dm/read.h b/include/dm/read.h index 894bc698bb49209c03e7cf74628a2600ea1be675..87017f076216492af5bb8da3a984ed1e074428cc 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -90,8 +90,8 @@ int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp); * @def: default value to return if the property has no value * Return: property value, or @def if not found */ -int dev_read_u32_default(const struct udevice *dev, const char *propname, - int def); +u32 dev_read_u32_default(const struct udevice *dev, const char *propname, + u32 def); /** * dev_read_u32_index() - read an indexed 32-bit integer from a device's DT @@ -896,7 +896,7 @@ static inline int dev_read_u32(const struct udevice *dev, } static inline int dev_read_u32_default(const struct udevice *dev, - const char *propname, int def) + const char *propname, u32 def) { return ofnode_read_u32_default(dev_ofnode(dev), propname, def); } -- 2.49.0