Skip to content

Commit

Permalink
iio:dac:ad3552r: Fix an IS_ERR() vs NULL check
Browse files Browse the repository at this point in the history
[ Upstream commit de3b9fe ]

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

Fixes: 8f2b548 ("drivers:iio:dac: Add AD3552R driver support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220404114244.GA19201@kili
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed May 9, 2022
1 parent 80e98fa commit a845674
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/iio/dac/ad3552r.c
Expand Up @@ -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;
Expand Down

0 comments on commit a845674

Please sign in to comment.