Skip to content

Commit 1fdf5c8

Browse files
dlechedoardocanepa
authored andcommitted
iio: adc: ad7380: fix adi,gain-milli property parsing
BugLink: https://bugs.launchpad.net/bugs/2123805 commit 24fa69894ea3f76ecb13d7160692ee574a912803 upstream. 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 <[email protected]> Link: https://patch.msgid.link/20250619-iio-adc-ad7380-fix-adi-gain-milli-parsing-v1-1-4c27fb426860@baylibre.com Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Edoardo Canepa <[email protected]>
1 parent a9d5be3 commit 1fdf5c8

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
@@ -1190,8 +1190,9 @@ static int ad7380_probe(struct spi_device *spi)
11901190

11911191
if (st->chip_info->has_hardware_gain) {
11921192
device_for_each_child_node_scoped(dev, node) {
1193-
unsigned int channel, gain;
1193+
unsigned int channel;
11941194
int gain_idx;
1195+
u16 gain;
11951196

11961197
ret = fwnode_property_read_u32(node, "reg", &channel);
11971198
if (ret)
@@ -1203,7 +1204,7 @@ static int ad7380_probe(struct spi_device *spi)
12031204
"Invalid channel number %i\n",
12041205
channel);
12051206

1206-
ret = fwnode_property_read_u32(node, "adi,gain-milli",
1207+
ret = fwnode_property_read_u16(node, "adi,gain-milli",
12071208
&gain);
12081209
if (ret && ret != -EINVAL)
12091210
return dev_err_probe(dev, ret,

0 commit comments

Comments
 (0)