[PATCH v2] i2c: npcm7xx: Remove redundant ret variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zhang Songyi <zhang.songyi@xxxxxxxxxx>

Return value from npcm_i2c_get_slave_addr() directly instead of taking
this in another redundant variable.

This improvement has been suggested by Zeal Robot <zealci@xxxxxxxxxx>

Signed-off-by: Zhang Songyi <zhang.songyi@xxxxxxxxxx>
Signed-off-by: Andi Shyti <andi.shyti@xxxxxxxxxx>
---
Hi,

I'm just fishing this patch from the past[*]. I made some tiny
changes in this v2.

Andi

Changelog:
v1 -> v2:
 - Rebased on top of the latest kernel.
 - Removed Zeal Robot's credit as "Reported-by:" tag as this is
   used mainly for bug reports.
 - Capitalized Zhang's name in the SoB.
 - Removed redundant cast to integer inside ioread8.

[*] https://patchwork.ozlabs.org/project/linux-i2c/patch/202211031628039654230@xxxxxxxxxx/

 drivers/i2c/busses/i2c-npcm7xx.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index de713b5747fe..a31d9a6677a8 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -1115,14 +1115,10 @@ static void npcm_i2c_master_abort(struct npcm_i2c *bus)
 #if IS_ENABLED(CONFIG_I2C_SLAVE)
 static u8 npcm_i2c_get_slave_addr(struct npcm_i2c *bus, enum i2c_addr addr_type)
 {
-	u8 slave_add;
-
 	if (addr_type > I2C_SLAVE_ADDR2 && addr_type <= I2C_SLAVE_ADDR10)
 		dev_err(bus->dev, "get slave: try to use more than 2 SA not supported\n");
 
-	slave_add = ioread8(bus->reg + npcm_i2caddr[(int)addr_type]);
-
-	return slave_add;
+	return ioread8(bus->reg + npcm_i2caddr[addr_type]);
 }
 
 static int npcm_i2c_remove_slave_addr(struct npcm_i2c *bus, u8 slave_add)
-- 
2.47.2





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux