[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <wi65rrkxd7f6n6nxse3p2bszv3lcko2qtflpbffngupqslcd3s@jvwec7rriqgo>
Date: Sat, 19 Jul 2025 01:44:58 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
To: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
Cc: Georgi Djakov <djakov@...nel.org>, Bjorn Andersson <andersson@...nel.org>,
linux-arm-msm@...r.kernel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 03/28] interconnect: qcom: rpmh: make nodes a
NULL_terminated array
On Sat, Jul 19, 2025 at 12:17:47AM +0200, Konrad Dybcio wrote:
> 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
No worries :-)
> this is a good solution.. maybe WARN_ON(!desc->num_nodes) would be better?
> Some static checks?
Another option would be to follow RPM path: move links into external
array and use ARRAY_SIZE. It's still error prone, but it is easier to
spot.
But really... For the array of pointers NULL trailer is the most logical
way of specifying the end of it.
>
> Konrad
--
With best wishes
Dmitry
Powered by blists - more mailing lists