Skip to contentSkip to conversation

i2c: s3c2410: Delete unneeded variable: "ret"

PATCH In review Xiang wangx 2 participants 2 messages Sep 16, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: s3c2410: Delete unneeded variable: "ret"

variable: "ret" defined but not used in function "i2c_s3c_irq_nextbyte"

---
 drivers/i2c/busses/i2c-s3c2410.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i2c/busses/i2c-s3c2410.c +1 -2
index b49a1b170bb2..6df85b23156c 100644
@@ -385,7 +385,6 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
 {
 	unsigned long tmp;
 	unsigned char byte;
-	int ret = 0;
 
 	switch (i2c->state) {
 
@@ -548,7 +547,7 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
 	tmp &= ~S3C2410_IICCON_IRQPEND;
 	writel(tmp, i2c->regs + S3C2410_IICCON);
  out:
-	return ret;
+	return 0;
 }
 
 /*
Signature · 1 line
2.20.1
#1 lore raw
Quoted 20 lines · Xiang wangx

variable: "ret" defined but not used in function "i2c_s3c_irq_nextbyte"

---
 drivers/i2c/busses/i2c-s3c2410.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/i2c/busses/i2c-s3c2410.c +0 -1
index b49a1b170bb2..6df85b23156c 100644
@@ -385,7 +385,6 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
 {
 	unsigned long tmp;
 	unsigned char byte;
-	int ret = 0;
 
 	switch (i2c->state) {
 

drivers/i2c/busses/i2c-s3c2410.c static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat) · line 550

Quoted 5 lines
drivers/i2c/busses/i2c-s3c2410.c +1 -1
@@ -548,7 +547,7 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
 	tmp &= ~S3C2410_IICCON_IRQPEND;
 	writel(tmp, i2c->regs + S3C2410_IICCON);
  out:
-	return ret;
+	return 0;

Change is okay but I would go step further - made the function return void(). None of the callers check for return so no functionality is lost.

Best regards,
Krzysztof