Re: [PATCH v9 5/6] iio: adc: ltc2378: Add support for LTC2338-18
Marcelo Schmitt <[email protected]>
| Newsgroups | org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree |
|---|---|
| Message-ID | <amiqwmIHsgO7v8zC@debian-BULLSEYE-live-builder-AMD64> |
On 07/27, [email protected] wrote: > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: > - [Low] Declaring a variable immediately after a switch case label without a block statement causes a compilation error. > -- > > --- Patch [5]: [PATCH v9 5/6] iio: adc: ltc2378: Add support for LTC2338-18 --- > commit 29728b1d34f34b2970657e2d83536de22940ee2e > Author: Marcelo Schmitt <[email protected]> > > iio: adc: ltc2378: Add support for LTC2338-18 > > This commit adds support for the LTC2338-18 ADC to the existing ltc2378 > driver. It extends the driver to handle the internal voltage reference and > input signal attenuation specific to this part. > > > diff --git a/drivers/iio/adc/ltc2378.c b/drivers/iio/adc/ltc2378.c > > --- a/drivers/iio/adc/ltc2378.c > > +++ b/drivers/iio/adc/ltc2378.c > > [ ... ] > > > @@ -383,7 +395,10 @@ static int ltc2378_read_raw(struct iio_dev *indio_dev, > > return IIO_VAL_INT; > > } > > case IIO_CHAN_INFO_SCALE: > > + struct u32_fract fract = st->info->internal_div; > > [Severity: Low] > Does this declaration cause a build error? No, at least not when I built with clang/llvm-22. > Declaring a variable immediately > after a switch case label without a block statement is not a valid statement > in C and usually causes a compiler error. Could this case be wrapped in a > block to scope the variable, or the declaration be moved to the top of the > function? > > > *val = st->ref_uV / MILLI; > > + if (fract.numerator && fract.denominator) > > + *val = mult_frac(*val, fract.numerator, fract.denominator); > > /* > > * For all LTC2378-like devices, the amount of bits that express > > * voltage magnitude depend on the polarity / output code format: > > -- > Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5