[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241012114953.25a958ef@jic23-huawei>
Date: Sat, 12 Oct 2024 11:49:53 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Vasileios Aoiridis <vassilisamir@...il.com>, "Yo-Jung (Leo) Lin"
<0xff07@...il.com>, linux-kernel-mentees@...ts.linuxfoundation.org,
ricardo@...liere.net, skhan@...uxfoundation.org, Lars-Peter Clausen
<lars@...afoo.de>, Nathan Chancellor <nathan@...nel.org>, Nick Desaulniers
<ndesaulniers@...gle.com>, Bill Wendling <morbo@...gle.com>, Justin Stitt
<justinstitt@...gle.com>, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com>, Angel Iglesias
<ang.iglesiasg@...il.com>, Adam Rizkalla <ajarizzo@...il.com>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH v2] iio: Fix uninitialized variable
On Fri, 11 Oct 2024 21:32:38 +0200
Javier Carrasco <javier.carrasco.cruz@...il.com> wrote:
> ...
>
> >
> > Hi everyone!
> >
> > So if you check also the conversations that we had here [1] and in the
> > previous versions, indeed the idea behind the offset is to use it as an
> > self-explanatory index to a char buffer that holds in fact s32 variables.
> >
> > The data->buf here holds the values that have just been read from the
> > sensor. If you check on the channel specification of this sensor,
> > you will see ".realbits = 24" in both values that the sensor returns so
> > hence the value 3.
> >
>
> So you are using 3 = 24 bits, but s32 not as 4 bytes? the whole thing
> would have turned into sensor_data[0], sensor_data[4], and no variables
> implied, correct? But I am discussing too much for something that in the
> end is more or less the same, I am fine with this proposal.
Applied the fix. Thanks,
Jonathan
>
> > I am not sure if it makes sense to use a macro here for each one of the
> > 3's that are going to be used only one time each and in order to be more
> > "consistent". But I might have a wrong view on this one so feel free to
> > correct me!
> >
> > For the initialization of the offset indeed, it was already mentioned
> > here [2] this morning, but on a different patch!!! I couldn't get this
> > error though with gcc...
> >
> > Cheers,
> > Vasilis
> >
>
> At least for the things I do in the kernel, clang catches more issues
> than gcc. Sometimes even gcc will not complain, and clang will fail to
> compile (e.g. a goto before a cleanup attribute).
>
> And if you run smatch before sending the series, you might discover a
> couple of extra "surprises".
>
> Best regards,
> Javier Carrasco
Powered by blists - more mailing lists