iio:dac:ad3552r: Fix an IS_ERR() vs NULL check
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.
--- drivers/iio/dac/ad3552r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/dac/ad3552r.c +2 -2
@@ -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
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 anIS_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")Signed-off-by Dan Carpenter <[email protected]>---
Quoted 25 lines
drivers/iio/dac/ad3552r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/dac/ad3552r.c +2
-2@@ -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
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 anIS_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")Signed-off-by Dan Carpenter <[email protected]>---
Reviewed-by Nuno Sá <[email protected]>
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@@ -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