* [PATCH] iio: proximity: hx9023s: Fix error code in hx9023s_property_get()
@ 2024-08-12 6:43 Dan Carpenter
2024-08-17 12:52 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-08-12 6:43 UTC (permalink / raw)
To: Yasin Lee
Cc: Jonathan Cameron, Lars-Peter Clausen, Nuno Sa, linux-iio,
linux-kernel, kernel-janitors
If we're returning because "reg >= HX9023S_CH_NUM" then set the error code
to -ENIVAL instead of success.
Fixes: 60df548277b7 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/iio/proximity/hx9023s.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
index fe14a62a1342..8b9f84400e00 100644
--- a/drivers/iio/proximity/hx9023s.c
+++ b/drivers/iio/proximity/hx9023s.c
@@ -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", ®);
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);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: proximity: hx9023s: Fix error code in hx9023s_property_get()
2024-08-12 6:43 [PATCH] iio: proximity: hx9023s: Fix error code in hx9023s_property_get() Dan Carpenter
@ 2024-08-17 12:52 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2024-08-17 12:52 UTC (permalink / raw)
To: Dan Carpenter
Cc: Yasin Lee, Lars-Peter Clausen, Nuno Sa, linux-iio, linux-kernel,
kernel-janitors
On Mon, 12 Aug 2024 09:43:05 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:
> If we're returning because "reg >= HX9023S_CH_NUM" then set the error code
> to -ENIVAL instead of success.
>
> Fixes: 60df548277b7 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Hi Dan,
Applied,
Thanks,
Jonathan
> ---
> drivers/iio/proximity/hx9023s.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
> index fe14a62a1342..8b9f84400e00 100644
> --- a/drivers/iio/proximity/hx9023s.c
> +++ b/drivers/iio/proximity/hx9023s.c
> @@ -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", ®);
> 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-17 12:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-12 6:43 [PATCH] iio: proximity: hx9023s: Fix error code in hx9023s_property_get() Dan Carpenter
2024-08-17 12:52 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox