Skip to content

Commit 24fa698

Browse files
dlechjic23
authored andcommitted
iio: adc: ad7380: fix adi,gain-milli property parsing
Change the data type of the "adi,gain-milli" property from u32 to u16. The devicetree binding specifies it as uint16, so we need to read it as such to avoid an -EOVERFLOW error when parsing the property. Fixes: c904e6d ("iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4") Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250619-iio-adc-ad7380-fix-adi-gain-milli-parsing-v1-1-4c27fb426860@baylibre.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 7b86482 commit 24fa698

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/iio/adc/ad7380.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,8 +1953,9 @@ static int ad7380_probe(struct spi_device *spi)
19531953

19541954
if (st->chip_info->has_hardware_gain) {
19551955
device_for_each_child_node_scoped(dev, node) {
1956-
unsigned int channel, gain;
1956+
unsigned int channel;
19571957
int gain_idx;
1958+
u16 gain;
19581959

19591960
ret = fwnode_property_read_u32(node, "reg", &channel);
19601961
if (ret)
@@ -1966,7 +1967,7 @@ static int ad7380_probe(struct spi_device *spi)
19661967
"Invalid channel number %i\n",
19671968
channel);
19681969

1969-
ret = fwnode_property_read_u32(node, "adi,gain-milli",
1970+
ret = fwnode_property_read_u16(node, "adi,gain-milli",
19701971
&gain);
19711972
if (ret && ret != -EINVAL)
19721973
return dev_err_probe(dev, ret,

0 commit comments

Comments
 (0)