On Wed, Mar 04, 2026 at 02:15:44PM +0530, Soham Kute wrote:
Return -ETIMEDOUT instead of -1 when the I2C byte write times out.
The callers check for non-zero return value and treat it as failure.
"The callers either ignore errors or treat all non-zero returns as
failure and return -1."
quoted hunk ↗ jump to hunk
Signed-off-by: Soham Kute <redacted>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index 0ef8d4ff2ef9..a17f758dda6c 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -294,7 +294,7 @@ static long sw_i2c_write_byte(unsigned char data)
Need to update the comments at the start of the function as well.
234 /*
235 * This function writes one byte to the slave device
236 *
237 * Parameters:
238 * data - Data to be write to the slave device
239 *
240 * Return Value:
241 * 0 - Success
242 * -1 - Fail to write byte
^^^^^^^^^^^^^^^^^^^^^^^^^
243 */
244 static long sw_i2c_write_byte(unsigned char data)
if (i < 0xff)
return 0;
else
- return -1;
+ return -ETIMEDOUT;
I don't think -ETIMEDOUT is the correct error code. Maybe -EIO or
-EINVAL.
regards,
dan carpenter