summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorZhang Songyi <zhang.songyi@zte.com.cn>2025-03-20 03:43:21 +0300
committerAndi Shyti <andi@smida.it>2025-05-19 23:23:54 +0300
commit5a1934f1c23feb525facdfa643600124a611c974 (patch)
treefb20c91f8a0adf0913deabae3385cacd3ec3593e /drivers/i2c
parentdb5194b793d5c40e1a510989bf4199c261b291ea (diff)
downloadlinux-5a1934f1c23feb525facdfa643600124a611c974.tar.xz
i2c: npcm7xx: Remove redundant ret variable
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@zte.com.cn> Signed-off-by: Zhang Songyi <zhang.songyi@zte.com.cn> Link: https://lore.kernel.org/r/20250320004321.1914366-1-andi.shyti@kernel.org Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-npcm7xx.c6
1 files changed, 1 insertions, 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)