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 e0ca9fe41..1ffdde957 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -118,7 +118,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;
 }
 
 static int32_t i2c_smbus_read_byte(int fd)
-- 
2.51.1.dirty

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

Reply via email to