Re: [PATCH] staging: sm750fb: use proper error codes instead of -1
From: Dan Carpenter
Date: Mon Mar 02 2026 - 04:13:06 EST
On Sun, Mar 01, 2026 at 10:44:34AM +0530, Soham Kute wrote:
> 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.
> @@ -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