From: Soham Kute <officialsohamkute@gmail.com>
To: sudipm.mukherjee@gmail.com, teddy.wang@siliconmotion.com
Cc: gregkh@linuxfoundation.org, linux-fbdev@vger.kernel.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
dan.carpenter@linaro.org,
Soham Kute <officialsohamkute@gmail.com>
Subject: [PATCH 6/6] staging: sm750fb: sm750_sw_i2c_init: return -EINVAL for invalid GPIO
Date: Wed, 4 Mar 2026 23:05:29 +0530 [thread overview]
Message-ID: <20260304173529.192067-6-officialsohamkute@gmail.com> (raw)
In-Reply-To: <20260304173529.192067-1-officialsohamkute@gmail.com>
Return -EINVAL instead of -1 when the GPIO pin number is out of
range. The caller ignores the return value.
Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index c73943341f66..46599be8d6b9 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -344,7 +344,7 @@ static unsigned char sw_i2c_read_byte(unsigned char ack)
* data_gpio - The GPIO pin to be used as i2c SDA
*
* Return Value:
- * -1 - Fail to initialize the i2c
+ * -EINVAL - Fail to initialize the i2c
* 0 - Success
*/
static long sm750le_i2c_init(unsigned char clk_gpio, unsigned char data_gpio)
@@ -382,7 +382,7 @@ static long sm750le_i2c_init(unsigned char clk_gpio, unsigned char data_gpio)
* data_gpio - The GPIO pin to be used as i2c SDA
*
* Return Value:
- * -1 - Fail to initialize the i2c
+ * -EINVAL - Fail to initialize the i2c
* 0 - Success
*/
long sm750_sw_i2c_init(unsigned char clk_gpio, unsigned char data_gpio)
@@ -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);
--
2.34.1
next prev parent reply other threads:[~2026-03-04 17:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Soham Kute [this message]
2026-03-05 5:48 ` [PATCH 6/6] staging: sm750fb: sm750_sw_i2c_init: return -EINVAL for invalid GPIO Dan Carpenter
2026-03-05 5:33 ` [PATCH 1/6] staging: sm750fb: hw_sm750le_de_wait: return -ETIMEDOUT on timeout Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260304173529.192067-6-officialsohamkute@gmail.com \
--to=officialsohamkute@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=sudipm.mukherjee@gmail.com \
--cc=teddy.wang@siliconmotion.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox