diff mbox series

[v5,3/3] iio: temperature: mlx90632 Change return value of sensor measurement channel

Message ID 7f99e81b31a5584b4f0d2f7d689026f6e47a2d12.1663577091.git.cmo@melexis.com (mailing list archive)
State Changes Requested
Headers show
Series iio: temperature: mlx90632: Add powermanagement | expand

Commit Message

Crt Mori Sept. 19, 2022, 8:48 a.m. UTC
From: Crt Mori <cmo@melexis.com>

The current EINVAL value is more applicable to embedded library, where
user can actually put the fixed value to the sensor. In case of the
driver if the value of the channel is invalid it is better in inform
userspace that Channel was out of range as that implies more to internal
driver error than invalid input. It also makes for easier debugging of
where the error comes from during the development.

Signed-off-by: Crt Mori <cmo@melexis.com>
---
 drivers/iio/temperature/mlx90632.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c
index c0bf385ebd6c..daaffe84b617 100644
--- a/drivers/iio/temperature/mlx90632.c
+++ b/drivers/iio/temperature/mlx90632.c
@@ -435,7 +435,7 @@  static int mlx90632_channel_new_select(int perform_ret, uint8_t *channel_new,
 		*channel_old = 1;
 		break;
 	default:
-		return -EINVAL;
+		return -ECHRNG;
 	}
 
 	return 0;