Skip to contentSkip to conversation

patch "iio: adc: ad7380: fix adi,gain-milli property parsing" added to char-misc-linus

PATCH [email protected] 1 participant 1 message Jul 4, 2025

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

iio: adc: ad7380: fix adi,gain-milli property parsing

to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 24fa69894ea3f76ecb13d7160692ee574a912803 Mon Sep 17 00:00:00 2001
From: David Lechner <[email protected]>
Date: Thu, 19 Jun 2025 10:24:22 -0500
Subject: 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.

---
 drivers/iio/adc/ad7380.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/adc/ad7380.c +3 -2
index d96bd12dfea6..cabf5511d116 100644
@@ -1953,8 +1953,9 @@ static int ad7380_probe(struct spi_device *spi)
 
 	if (st->chip_info->has_hardware_gain) {
 		device_for_each_child_node_scoped(dev, node) {
-			unsigned int channel, gain;
+			unsigned int channel;
 			int gain_idx;
+			u16 gain;
 
 			ret = fwnode_property_read_u32(node, "reg", &channel);
 			if (ret)
@@ -1966,7 +1967,7 @@ static int ad7380_probe(struct spi_device *spi)
 						     "Invalid channel number %i\n",
 						     channel);
 
-			ret = fwnode_property_read_u32(node, "adi,gain-milli",
+			ret = fwnode_property_read_u16(node, "adi,gain-milli",
 						       &gain);
 			if (ret && ret != -EINVAL)
 				return dev_err_probe(dev, ret,
Signature · 1 line
2.50.0