[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aU_zUI8xOt7Cl5vP@smile.fi.intel.com>
Date: Sat, 27 Dec 2025 16:55:12 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Kyle Hsieh <kylehsieh1995@...il.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Liam Beguin <liambeguin@...il.com>, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] iio: adc: ltc2309: add support for ltc2305
On Wed, Dec 24, 2025 at 01:37:15PM +0800, Kyle Hsieh wrote:
> Add support for the 2-channel LTC2305 ADC in the existing LTC2309 driver.
> The LTC2305 and LTC2309 share similar features: both are 12-bit,
> low-noise, low-power SAR ADCs with an I2C interface.
> The main difference is the number of channels: LTC2305 has 2 channels,
> while LTC2309 has 8 channels.
> /* Order matches expected channel address, See datasheet Table 1. */
> +enum ltc2305_channels {
> + LTC2305_CH0_CH1 = 0,
> + LTC2305_CH1_CH0,
> + LTC2305_CH0,
> + LTC2305_CH1,
When it's hardware defined, assign all of them explicitly. Otherwise drop the
unneeded 0 which is guaranteed by the C standard.
> +};
...
> + chip_info = i2c_get_match_data(client);
> + if (!chip_info)
> + return -EINVAL;
I consider this check redundant. There is shouldn't be a production code that
works nicely when there is a clear mistake in it (absence of the mandatory
static initialiser). The author of the change should have been testing this
and hence it will Oops the kernel, which means that the initial code is b0rken.
So, drop the dead check.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists