[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <wfm2xgyf67erkl57d4ztnj7t7cezkeohne2bcz42crtjwmjp5j@wfakrtwjizkq>
Date: Thu, 26 Sep 2024 14:48:44 +0200
From: Bjorn Andersson <andersson@...nel.org>
To: Vladimir Zapolskiy <vladimir.zapolskiy@...aro.org>
Cc: Manikanta Mylavarapu <quic_mmanikan@...cinc.com>,
andi.shyti@...nel.org, linux-arm-msm@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org, quic_srichara@...cinc.com, quic_varada@...cinc.com
Subject: Re: [PATCH v2 1/1] i2c: qcom-geni: Support systems with 32MHz serial
engine clock
On Thu, Sep 26, 2024 at 01:28:37PM GMT, Vladimir Zapolskiy wrote:
> On 9/26/24 06:43, Manikanta Mylavarapu wrote:
> > diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
[..]
> > +
> > static int geni_i2c_clk_map_idx(struct geni_i2c_dev *gi2c)
> > {
> > int i;
> > - const struct geni_i2c_clk_fld *itr = geni_i2c_clk_map;
> > + const struct geni_i2c_clk_fld *itr;
> > +
> > + if (clk_get_rate(gi2c->se.clk) == 32 * HZ_PER_MHZ)
> > + itr = geni_i2c_clk_map_32mhz;
> > + else
> > + itr = geni_i2c_clk_map_19p2mhz;
> > - for (i = 0; i < ARRAY_SIZE(geni_i2c_clk_map); i++, itr++) {
> > + for (i = 0; i < ARRAY_SIZE(geni_i2c_clk_map_19p2mhz); i++, itr++) {
>
> Struct/data organization here is so weak, that here it's implicitly assumed
> that sizes of two arrays are equal. It could be kept as is of course, just
> pointing to it.
>
Thanks for pointing this out, Vladimir.
I'd prefer we fix it by adding a sentinel value to the arrays - because
this was only spotted due to the rename, the next guy will not be so
lucky.
Regards,
Bjorn
> > if (itr->clk_freq_out == gi2c->clk_freq_out) {
> > gi2c->clk_fld = itr;
> > return 0;
>
> --
> Best wishes,
> Vladimir
>
Powered by blists - more mailing lists