Re: [PATCH v2 03/28] interconnect: qcom: rpmh: make nodes a NULL_terminated array

From: Konrad Dybcio
Date: Fri Jul 18 2025 - 18:18:05 EST


On 7/18/25 7:26 PM, Dmitry Baryshkov wrote:
> On Fri, Jul 18, 2025 at 04:38:02PM +0300, Georgi Djakov wrote:
>> Hi Dmitry,
>>
>> On 7/4/25 7:35 PM, Dmitry Baryshkov wrote:
>>> Having the .num_nodes as a separate struct field can provoke errors as
>>> it is easy to omit it or to put an incorrect value into that field. Turn
>>> .nodes into a NULL-terminated array, removing a need for a separate
>>> .num_nodes field.
>>
>> I am not entirely convinced that an error in the termination is more
>> unlikely than an error in the num_nodes. Aren't we trading one kind of
>> error for another? Also if we omit the num_nodes i expect that just the
>> QoS of a specific path will fail, but if we miss the NULL - worse things
>> might happen.
>
> Exactly, that's the point. It is easy to miss num_nodes, while omitting
> NULL will crash the driver. So the error will be noted during
> development.

I really don't wanna step on your development, but again, I don't think
this is a good solution.. maybe WARN_ON(!desc->num_nodes) would be better?
Some static checks?

Konrad