[PATCH 03/13] eeprom: ee1004: Remove not needed check in ee1004_eeprom_read

From: Heiner Kallweit
Date: Mon May 24 2021 - 16:18:50 EST


i2c_smbus_read_i2c_block_data_or_emulated() checks its length argument,
so we don't have to do it. In addition remove the unlikely hint from
the checks, we do i2c reads and therefore are in a slow path.

Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
---
drivers/misc/eeprom/ee1004.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/misc/eeprom/ee1004.c b/drivers/misc/eeprom/ee1004.c
index 6aff333ff..2824dba76 100644
--- a/drivers/misc/eeprom/ee1004.c
+++ b/drivers/misc/eeprom/ee1004.c
@@ -76,10 +76,8 @@ static ssize_t ee1004_eeprom_read(struct i2c_client *client, char *buf,
{
int status;

- if (count > I2C_SMBUS_BLOCK_MAX)
- count = I2C_SMBUS_BLOCK_MAX;
/* Can't cross page boundaries */
- if (unlikely(offset + count > EE1004_PAGE_SIZE))
+ if (offset + count > EE1004_PAGE_SIZE)
count = EE1004_PAGE_SIZE - offset;

status = i2c_smbus_read_i2c_block_data_or_emulated(client, offset,
--
2.31.1