public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: sm750fb: use proper error codes instead of -1
@ 2026-03-01  5:14 Soham Kute
  2026-03-02  9:09 ` Dan Carpenter
  0 siblings, 1 reply; 22+ messages in thread
From: Soham Kute @ 2026-03-01  5:14 UTC (permalink / raw)
  To: sudipm.mukherjee, teddy.wang, gregkh
  Cc: linux-fbdev, linux-staging, linux-kernel, Soham Kute

Replace magic return value -1 with proper kernel error
codes -EBUSY, -ETIMEDOUT and -EINVAL.

Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
---
 drivers/staging/sm750fb/ddk750_swi2c.c | 4 ++--
 drivers/staging/sm750fb/sm750_accel.c  | 6 +++---
 drivers/staging/sm750fb/sm750_hw.c     | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

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;
 }
 
 /*
@@ -394,7 +394,7 @@ long sm750_sw_i2c_init(unsigned char clk_gpio, unsigned char data_gpio)
 	 * range is only from [0..63]
 	 */
 	if ((clk_gpio > 31) || (data_gpio > 31))
-		return -1;
+		return -EINVAL;
 
 	if (sm750_get_chip_type() == SM750LE)
 		return sm750le_i2c_init(clk_gpio, data_gpio);
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index 046b9282b24a..fa593d4f31fe 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -97,7 +97,7 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
 		 * got something error
 		 */
 		pr_debug("De engine always busy\n");
-		return -1;
+		return -EBUSY;
 	}
 
 	write_dpr(accel, DE_WINDOW_DESTINATION_BASE, base); /* dpr40 */
@@ -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)
-		return -1;
+		return -EBUSY;
 
 	write_dpr(accel, DE_SOURCE,
 		  ((sx << DE_SOURCE_X_K1_SHIFT) & DE_SOURCE_X_K1_MASK) |
@@ -333,7 +333,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
 	ulBytesRemain = ulBytesPerScan & 3;
 
 	if (accel->de_wait() != 0)
-		return -1;
+		return -EBUSY;
 
 	/*
 	 * 2D Source Base.
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index ce46f240cbaf..e4b6b254335e 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -518,7 +518,7 @@ int hw_sm750le_de_wait(void)
 			return 0;
 	}
 	/* timeout error */
-	return -1;
+	return -ETIMEDOUT;
 }
 
 int hw_sm750_de_wait(void)
@@ -536,7 +536,7 @@ int hw_sm750_de_wait(void)
 			return 0;
 	}
 	/* timeout error */
-	return -1;
+	return -ETIMEDOUT;
 }
 
 int hw_sm750_pan_display(struct lynxfb_crtc *crtc,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2026-03-05  5:48 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-01  5:14 [PATCH] staging: sm750fb: use proper error codes instead of -1 Soham Kute
2026-03-02  9:09 ` Dan Carpenter
2026-03-04  8:45   ` [PATCH v2 0/6] staging: sm750fb: fix error return values Soham Kute
2026-03-04  8:45     ` [PATCH 1/6] staging: sm750fb: hw_sm750le_de_wait: return -ETIMEDOUT on timeout Soham Kute
2026-03-04  8:45     ` [PATCH 2/6] staging: sm750fb: sm750_hw_fillrect: propagate de_wait() error Soham Kute
2026-03-04  8:45     ` [PATCH 3/6] staging: sm750fb: sm750_hw_copyarea: " Soham Kute
2026-03-04 14:24       ` Dan Carpenter
2026-03-04  8:45     ` [PATCH 4/6] staging: sm750fb: sm750_hw_imageblit: " Soham Kute
2026-03-04 14:25       ` Dan Carpenter
2026-03-04  8:45     ` [PATCH 5/6] staging: sm750fb: sw_i2c_write_byte: return -ETIMEDOUT on timeout Soham Kute
2026-03-04 14:29       ` Dan Carpenter
2026-03-04  8:45     ` [PATCH 6/6] staging: sm750fb: sm750_sw_i2c_init: return -EINVAL for invalid GPIO Soham Kute
2026-03-04 14:30       ` Dan Carpenter
2026-03-04 17:35   ` [PATCH 1/6] staging: sm750fb: hw_sm750le_de_wait: return -ETIMEDOUT on timeout Soham Kute
2026-03-04 17:35     ` [PATCH 2/6] staging: sm750fb: sm750_hw_fillrect: propagate de_wait() error Soham Kute
2026-03-05  5:34       ` Dan Carpenter
2026-03-04 17:35     ` [PATCH 3/6] staging: sm750fb: sm750_hw_copyarea: " Soham Kute
2026-03-04 17:35     ` [PATCH 4/6] staging: sm750fb: sm750_hw_imageblit: " Soham Kute
2026-03-04 17:35     ` [PATCH 5/6] staging: sm750fb: sw_i2c_write_byte: return -EIO on failure Soham Kute
2026-03-04 17:35     ` [PATCH 6/6] staging: sm750fb: sm750_sw_i2c_init: return -EINVAL for invalid GPIO Soham Kute
2026-03-05  5:48       ` Dan Carpenter
2026-03-05  5:33     ` [PATCH 1/6] staging: sm750fb: hw_sm750le_de_wait: return -ETIMEDOUT on timeout Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox