Skip to contentSkip to conversation

iio:dac:ad3552r: Fix an IS_ERR() vs NULL check

PATCH Applied Dan Carpenter 3 participants 3 messages Apr 4, 2022 – Apr 10, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio:dac:ad3552r: Fix an IS_ERR() vs NULL check

The fwnode_get_named_child_node() function does not return error pointers. It returns NULL. Update the check accordingly.

Fixes 8f2b54824b28 ("drivers:iio:dac: Add AD3552R driver support")
---
 drivers/iio/dac/ad3552r.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad3552r.c +2 -2
index 97f13c0b9631..59f49b7564b2 100644
@@ -809,10 +809,10 @@ static int ad3552r_configure_custom_gain(struct ad3552r_desc *dac,
 
 	gain_child = fwnode_get_named_child_node(child,
 						 "custom-output-range-config");
-	if (IS_ERR(gain_child)) {
+	if (!gain_child) {
 		dev_err(dev,
 			"mandatory custom-output-range-config property missing\n");
-		return PTR_ERR(gain_child);
+		return -EINVAL;
 	}
 
 	dac->ch_data[ch].range_override = 1;
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines

From: Dan Carpenter <[email protected]>
Sent: Monday, April 4, 2022 1:43 PM
To: Lars-Peter Clausen <[email protected]>
Cc: Hennerich, Michael <[email protected]>; Jonathan Cameron <[email protected]>; [email protected]; Sa, Nuno <[email protected]>; [email protected]
Subject: [PATCH] iio:dac:ad3552r: Fix an IS_ERR() vs NULL check

Quoted 8 lines

[External]

The fwnode_get_named_child_node() function does not return error pointers. It returns NULL. Update the check accordingly.

Fixes 8f2b54824b28 ("drivers:iio:dac: Add AD3552R driver support")

---

Quoted 25 lines
 drivers/iio/dac/ad3552r.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad3552r.c +2 -2
index 97f13c0b9631..59f49b7564b2 100644
@@ -809,10 +809,10 @@ static int
 ad3552r_configure_custom_gain(struct ad3552r_desc *dac,
 
 	gain_child = fwnode_get_named_child_node(child,
 						 "custom-output-range-
 config");
-	if (IS_ERR(gain_child)) {
+	if (!gain_child) {
 		dev_err(dev,
 			"mandatory custom-output-range-config
 property missing\n");
-		return PTR_ERR(gain_child);
+		return -EINVAL;
drivers/iio/dac/ad3552r.c +0 -1
 	}
 
 	dac->ch_data[ch].range_override = 1;
--

2.20.1

maintainer Applied
#2 lore raw
Quoted 10 lines · Nuno
Quoted 10 lines

From: Dan Carpenter <[email protected]>
Sent: Monday, April 4, 2022 1:43 PM
To: Lars-Peter Clausen <[email protected]>
Cc: Hennerich, Michael <[email protected]>; Jonathan Cameron <[email protected]>; [email protected]; Sa, Nuno <[email protected]>; [email protected]
Subject: [PATCH] iio:dac:ad3552r: Fix an IS_ERR() vs NULL check

[External]

Quoted 8 lines
Quoted 6 lines

The fwnode_get_named_child_node() function does not return error pointers. It returns NULL. Update the check accordingly.

Fixes 8f2b54824b28 ("drivers:iio:dac: Add AD3552R driver support")

---

Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

Quoted 27 lines
Quoted 26 lines
 drivers/iio/dac/ad3552r.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad3552r.c +2 -2
index 97f13c0b9631..59f49b7564b2 100644
@@ -809,10 +809,10 @@ static int
 ad3552r_configure_custom_gain(struct ad3552r_desc *dac,
 
 	gain_child = fwnode_get_named_child_node(child,
 						 "custom-output-range-
 config");
-	if (IS_ERR(gain_child)) {
+	if (!gain_child) {
 		dev_err(dev,
 			"mandatory custom-output-range-config
 property missing\n");
-		return PTR_ERR(gain_child);
+		return -EINVAL;
drivers/iio/dac/ad3552r.c +0 -1
 	}
 
 	dac->ch_data[ch].range_override = 1;
--

2.20.1