From: Olliver Schinagl <[email protected]>

We shouldn't return -1 (the default error code for the ioctl) but
instead return errno. Our big brother does the same, so we should follow
suit.

Signed-off-by: Olliver Schinagl <[email protected]>
---
 miscutils/i2c_tools.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index 3a7df3b1e..166c9f6bb 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -117,7 +117,10 @@ static int32_t i2c_smbus_access(int fd, char read_write, 
uint8_t cmd,
        args.size = size;
        args.data = data;
 
-       return ioctl(fd, I2C_SMBUS, &args);
+       if (ioctl(fd, I2C_SMBUS, &args))
+               return -errno;
+
+       return 0;
 }
 
 #if ENABLE_I2CGET || ENABLE_I2CSET || ENABLE_I2CDUMP || ENABLE_I2CDETECT
-- 
2.40.1

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to