Commit d3bde224 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jonathan Cameron

iio: proximity: hx9023s: Fix error code in hx9023s_property_get()

If we're returning because "reg >= HX9023S_CH_NUM" then set the error code
to -ENIVAL instead of success.

Fixes: 60df5482 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/49b5a9bc-e5ca-43a7-a665-313eb06fbe27@stanley.mountainSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 076c4d18
......@@ -598,7 +598,8 @@ static int hx9023s_property_get(struct hx9023s_data *data)
device_for_each_child_node_scoped(dev, child) {
ret = fwnode_property_read_u32(child, "reg", &reg);
if (ret || reg >= HX9023S_CH_NUM)
return dev_err_probe(dev, ret, "Failed to read reg\n");
return dev_err_probe(dev, ret < 0 ? ret : -EINVAL,
"Failed to read reg\n");
__set_bit(reg, &data->chan_in_use);
ret = fwnode_property_read_u32(child, "single-channel", &temp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment