Thread (22 messages) 22 messages, 2 authors, 2026-03-05

Re: [PATCH] staging: sm750fb: use proper error codes instead of -1

From: Dan Carpenter <hidden>
Date: 2026-03-02 09:09:48
Also in: linux-staging, lkml

On Sun, Mar 01, 2026 at 10:44:34AM +0530, Soham Kute wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index 0ef8d4ff2ef9..d90a93ab8fdc 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)
 	if (i < 0xff)
 		return 0;
 	else
-		return -1;
+		return -ETIMEDOUT;
The comment still says this returns -1.

Actually could you do this one function at a time, and in each commit
message please say "The callers propogate the error code back" or "
None of the callers check the error code" or "The callers treat all
non-zero error codes as failure and return -EINVAL" or whatever.

quoted hunk ↗ jump to hunk
@@ -264,7 +264,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
 		  (sPitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */
 
 	if (accel->de_wait() != 0)
Did you consider propagating the error code from accel->de_wait()
instead?  That feels like a better solution but I haven't looked at
it at all.

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help