[PATCH] dm: Fix OF_BAD_ADDR definition
Patrice CHOTARD
patrice.chotard at foss.st.com
Tue Jan 4 08:38:45 CET 2022
Hi Simon
On 12/24/21 2:17 PM, Simon Glass wrote:
> Hi Patrice,
>
> On Thu, 23 Dec 2021 at 09:09, Patrice Chotard
> <patrice.chotard at foss.st.com> wrote:
>>
>> When OF_LIVE flag is enabled on a 64 bits platform, there is an
>> issue when dev_read_addr() is called and need to perform an address
>> translation using __of_translate_address().
>>
>> In case of error, __of_translate_address() return value is OF_BAD_ADDR
>> (wich is defined in include/dm/of.h to ((u64)-1) = 0xffffffffffffffff).
>> The return value of dev_read_addr() is often compared to FDT_ADDR_T_NONE
>> which is defined as (-1U) = 0xffffffff.
>> In this case the comparison is always false.
>>
>> To fix this issue, define OF_BAD_ADDR to FDT_ADDR_T_NONE.
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
>> ---
>>
>> include/dm/of.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Would it be better to define FDT_ADDR_T_NONE as something like ((ulong)(-1)) ?
Agree, a v2 will be sent soon.
Thanks
Patrice
>>
>> diff --git a/include/dm/of.h b/include/dm/of.h
>> index 5cb6f44a6c..0208cc234a 100644
>> --- a/include/dm/of.h
>> +++ b/include/dm/of.h
>> @@ -95,7 +95,7 @@ static inline bool of_live_active(void)
>> return gd_of_root() != NULL;
>> }
>>
>> -#define OF_BAD_ADDR ((u64)-1)
>> +#define OF_BAD_ADDR FDT_ADDR_T_NONE
>>
>> static inline const char *of_node_full_name(const struct device_node *np)
>> {
>> --
>> 2.17.1
>>
>
> Regards,
> Simon
>
More information about the U-Boot
mailing list