Skip to content

Commit 3bca779

Browse files
committed
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> (cherry picked from commit 24fa698)
1 parent b8efa2a commit 3bca779

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/iio/adc/ad7380.c

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

19981998
if (st->chip_info->has_hardware_gain) {
19991999
device_for_each_child_node_scoped(dev, node) {
2000-
unsigned int channel, gain;
2000+
unsigned int channel;
20012001
int gain_idx;
2002+
u16 gain;
20022003

20032004
ret = fwnode_property_read_u32(node, "reg", &channel);
20042005
if (ret)
@@ -2010,7 +2011,7 @@ static int ad7380_probe(struct spi_device *spi)
20102011
"Invalid channel number %i\n",
20112012
channel);
20122013

2013-
ret = fwnode_property_read_u32(node, "adi,gain-milli",
2014+
ret = fwnode_property_read_u16(node, "adi,gain-milli",
20142015
&gain);
20152016
if (ret && ret != -EINVAL)
20162017
return dev_err_probe(dev, ret,

0 commit comments

Comments
 (0)