i2c: cadence: Remove redundant expression in if clause
authorLars-Peter Clausen <lars@metafoo.de>
Sat, 7 Jan 2023 21:18:12 +0000 (13:18 -0800)
committerWolfram Sang <wsa@kernel.org>
Fri, 20 Jan 2023 08:55:52 +0000 (09:55 +0100)
commita4a1a78e3b5e511e6e5ca7407141911acdd0d3aa
tree130dabcffd8b92c994907a47e2dc757f50f5aeb8
parent2264997254ca1123967ed890c7924ca848c512a5
i2c: cadence: Remove redundant expression in if clause

In the mrecv() function the Cadence I2C driver has the following expression
in an if clause.

((id->p_msg->flags & I2C_M_RECV_LEN) != I2C_M_RECV_LEN) &&
 (id->recv_count <= CDNS_I2C_FIFO_DEPTH))

Earlier in the same function when I2C_M_RECV_LEN is set the recv_count is
initialized to a value that is larger than CDNS_I2C_FIFO_DEPTH. This means
if the first expression is false the second expression is also false.
Checking the first expression is thus redundant and can be removed.

This slightly simplifies the logic.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-cadence.c