[PATCH] i2c: s3c2410: change return type of 'i2c_s3c_irq_nextbyte' from 'int' to 'void'

Yihao Han posted 1 patch 4 years ago
There is a newer version of this series
drivers/i2c/busses/i2c-s3c2410.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
[PATCH] i2c: s3c2410: change return type of 'i2c_s3c_irq_nextbyte' from 'int' to 'void'
Posted by Yihao Han 4 years ago
Since ret is a redundant variable, and none of the callers check
for return, so remove ret variable and change return type of 
'i2c_s3c_irq_nextbyte' from 'int' to 'void'

Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 drivers/i2c/busses/i2c-s3c2410.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index b49a1b170bb2..75ddf7ffb028 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -381,17 +381,15 @@ static inline int is_msgend(struct s3c24xx_i2c *i2c)
 /*
  * process an interrupt and work out what to do
  */
-static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
+static void i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
 {
 	unsigned long tmp;
 	unsigned char byte;
-	int ret = 0;
 
 	switch (i2c->state) {
 
 	case STATE_IDLE:
 		dev_err(i2c->dev, "%s: called in STATE_IDLE\n", __func__);
-		goto out;
 
 	case STATE_STOP:
 		dev_err(i2c->dev, "%s: called in STATE_STOP\n", __func__);
@@ -547,8 +545,6 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
 	tmp = readl(i2c->regs + S3C2410_IICCON);
 	tmp &= ~S3C2410_IICCON_IRQPEND;
 	writel(tmp, i2c->regs + S3C2410_IICCON);
- out:
-	return ret;
 }
 
 /*
-- 
2.17.1
Re: [PATCH] i2c: s3c2410: change return type of 'i2c_s3c_irq_nextbyte' from 'int' to 'void'
Posted by Krzysztof Kozlowski 4 years ago
On 06/05/2022 13:34, Yihao Han wrote:
> Since ret is a redundant variable, and none of the callers check
> for return, so remove ret variable and change return type of 
> 'i2c_s3c_irq_nextbyte' from 'int' to 'void'
> 
> Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
>  drivers/i2c/busses/i2c-s3c2410.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index b49a1b170bb2..75ddf7ffb028 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -381,17 +381,15 @@ static inline int is_msgend(struct s3c24xx_i2c *i2c)
>  /*
>   * process an interrupt and work out what to do
>   */
> -static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
> +static void i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
>  {
>  	unsigned long tmp;
>  	unsigned char byte;
> -	int ret = 0;
>  
>  	switch (i2c->state) {
>  
>  	case STATE_IDLE:
>  		dev_err(i2c->dev, "%s: called in STATE_IDLE\n", __func__);
> -		goto out;

This does not look equivalent. Should be a return here.


Best regards,
Krzysztof