Re: [PATCH 6/6] staging: sm750fb: sm750_sw_i2c_init: return -EINVAL for invalid GPIO

From: Dan Carpenter

Date: Wed Mar 04 2026 - 09:33:21 EST


On Wed, Mar 04, 2026 at 02:15:45PM +0530, Soham Kute wrote:
> Return -EINVAL instead of -1 when the GPIO pin number is out of
> range. The caller checks for non-zero return value as failure.
>

The caller ignores errors.

> Signed-off-by: Soham Kute <officialsohamkute@xxxxxxxxx>
> ---
> 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 a17f758dda6c..d90a93ab8fdc 100644
> --- a/drivers/staging/sm750fb/ddk750_swi2c.c
> +++ b/drivers/staging/sm750fb/ddk750_swi2c.c
> @@ -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;

Need to update the comments for the function.

regards,
dan carpenter

>
> if (sm750_get_chip_type() == SM750LE)
> return sm750le_i2c_init(clk_gpio, data_gpio);
> --
> 2.34.1