[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240914174653.1c8788de@jic23-huawei>
Date: Sat, 14 Sep 2024 17:46:53 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Ramona Alexandra Nechita <ramona.nechita@...log.com>, Lars-Peter Clausen
<lars@...afoo.de>, Cosmin Tanislav <cosmin.tanislav@...log.com>, Michael
Hennerich <Michael.Hennerich@...log.com>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Nuno Sa <nuno.sa@...log.com>, Andy Shevchenko
<andy@...nel.org>, David Lechner <dlechner@...libre.com>, Marcelo Schmitt
<marcelo.schmitt@...log.com>, Olivier Moysan <olivier.moysan@...s.st.com>,
Dumitru Ceclan <mitrutzceclan@...il.com>, Matteo Martelli
<matteomartelli3@...il.com>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, Alisa-Dariana Roman
<alisadariana@...il.com>, Ivan Mikhaylov <fr0st61te@...il.com>, Mike
Looijmans <mike.looijmans@...ic.nl>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v5 3/3] drivers: iio: adc: add support for ad777x family
> ...
>
> > + iio_device_claim_direct_scoped(return -EBUSY, indio_dev) {
> > + switch (mask) {
> > + case IIO_CHAN_INFO_CALIBSCALE:
> > + *val = ad7779_get_calibscale(st, chan->channel);
> > + if (*val < 0)
> > + return -EINVAL;
> > + *val2 = GAIN_REL;
> > + return IIO_VAL_FRACTIONAL;
> > + case IIO_CHAN_INFO_CALIBBIAS:
> > + *val = ad7779_get_calibbias(st, chan->channel);
> > + if (*val < 0)
> > + return -EINVAL;
> > + return IIO_VAL_INT;
> > + case IIO_CHAN_INFO_SAMP_FREQ:
> > + *val = st->sampling_freq;
> > + if (*val < 0)
> > + return -EINVAL;
> > + return IIO_VAL_INT;
> > + }
> > + return -EINVAL;
> > + }
>
> > + unreachable();
>
> Hmm... Is it necessary? Same Q for other similar cases. I.o.w. what
> will be if we don't add this line?
The compiler can't tell that the contents of iio_device_claim_direct_scoped()
always runs. Hence normal result is it complains that nothing was returned.
Why the compiler can't figure out? Who knows...
Jonathan
Powered by blists - more mailing lists