diff options
author | Rand Deeb <rand.sec96@gmail.com> | 2024-02-06 20:42:01 +0100 |
---|---|---|
committer | Andi Shyti <andi.shyti@kernel.org> | 2024-02-14 22:51:54 +0100 |
commit | 48acf8292280f257fb0047478153a81471ee7f4d (patch) | |
tree | 9113e63d5361fcc8651fa9b8e1d8f2554444efe9 /drivers/i2c | |
parent | i2c: i801: Add helper i801_get_block_len (diff) | |
download | linux-48acf8292280f257fb0047478153a81471ee7f4d.tar.xz linux-48acf8292280f257fb0047478153a81471ee7f4d.zip |
i2c: Remove redundant comparison in npcm_i2c_reg_slave
In the npcm_i2c_reg_slave() function, there was a redundant
comparison that checked if 'bus->slave' was null immediately after
assigning it the 'client' value. There were concerns about a
potential null dereference because of `client->adapter`, but
according to Wolfram Sang, "we trusted ourselves here" Therefore,
this comparison is unnecessary.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Rand Deeb <rand.sec96@gmail.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-npcm7xx.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c index 54181b3f1919..2fe68615942e 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -1264,9 +1264,6 @@ static int npcm_i2c_reg_slave(struct i2c_client *client) bus->slave = client; - if (!bus->slave) - return -EINVAL; - if (client->flags & I2C_CLIENT_TEN) return -EAFNOSUPPORT; |