Re: [PATCH v3] of: property: Increase NR_FWNODE_REFERENCE_ARGS
From: Zijun Hu
Date: Tue Feb 11 2025 - 07:20:22 EST
On 2025/2/10 23:34, Andy Shevchenko wrote:
>> It may cause firmware node reference's argument count out of range if
>> directly assign DT node reference's argument count to firmware's.
>>
>> drivers/of/property.c:of_fwnode_get_reference_args() is doing the direct
>> assignment, so may cause firmware's argument count @args->nargs got out
>> of range, namely, in [9, 16].
>>
>> Fix by increasing NR_FWNODE_REFERENCE_ARGS to 16 to meet DT requirement.
> ...
>
>> -#define NR_FWNODE_REFERENCE_ARGS 8
>> +#define NR_FWNODE_REFERENCE_ARGS 16
> Thinking of the case, perhaps you also want
>
> static_assert(NR_FWNODE_REFERENCE_ARGS == MAX_PHANDLE_ARGS);
>
> to be put somewhere, but I don't think we can do it in this header file.
thank you Andy for code review.
yes. it seems there are good location to place the static_assert().
is it okay to associate two macros by
#define MAX_PHANDLE_ARGS NR_FWNODE_REFERENCE_ARGS
OR
replace all MAX_PHANDLE_ARGS instances with NR_FWNODE_REFERENCE_ARGS
?