On Tue, 11 Jun 2024 at 07:04, Quentin Schulz <foss+ub...@0leil.net> wrote:
>
> From: Quentin Schulz <quentin.sch...@cherry.de>
>
> outp always point to an unsigned type in ofnode_read_u* functions but
> the format specifier is currently always using signed type.
>
> This is an issue since the signed type can only contain half of the
> unsigned type values above 0.
>
> However, this now breaks another usecase. Indeed,
> ofnode_read_s32_default is actually passing an s32 but it'll be printed
> as a u32 instead. But since the function is called u32, it makes more
> sense to have it print an unsigned value.
>
> This was discovered because arm,smc-id = <0x82000010>; on RK3588S is
> above the max signed value and therefore would return a negative signed
> decimal value instead of its proper unsigned one.
>
> Fixes: fa12dfa08a7b ("dm: core: support reading a single indexed u64 value")
> Fixes: 4bb7075c830c ("dm: core: support reading a single indexed u32 value")
> Fixes: 7e5196c409f1 ("dm: core: Add ofnode function to read a 64-bit int")
> Fixes: 9e51204527dc ("dm: core: Add operations on device tree references")
> Signed-off-by: Quentin Schulz <quentin.sch...@cherry.de>
> ---
>  drivers/core/ofnode.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass <s...@chromium.org>

Reply via email to