Skip to content

Commit 48acf82

Browse files
RandDeebAndi Shyti
authored andcommitted
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 <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent 857cc04 commit 48acf82

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

drivers/i2c/busses/i2c-npcm7xx.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,9 +1264,6 @@ static int npcm_i2c_reg_slave(struct i2c_client *client)
12641264

12651265
bus->slave = client;
12661266

1267-
if (!bus->slave)
1268-
return -EINVAL;
1269-
12701267
if (client->flags & I2C_CLIENT_TEN)
12711268
return -EAFNOSUPPORT;
12721269

0 commit comments

Comments
 (0)