eeprom: ee1004: Remove not needed check in ee1004_eeprom_read
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 24 May 2021 20:10:47 +0000 (22:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 May 2021 12:49:39 +0000 (14:49 +0200)
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@gmail.com>
Link: https://lore.kernel.org/r/eb2a8bff-43ec-c763-a417-9d741e6f0034@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/eeprom/ee1004.c

index 6aff333ff049419547d06d13dec147ab0243e22e..2824dba768580291d16dcfc7266da79a43160e14 100644 (file)
@@ -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,