misc: ds1682: clean up ds1682_eeprom_read() and ds1682_eeprom_write()
authorVladimir Zapolskiy <vz@mleia.com>
Sun, 26 Jul 2015 21:18:47 +0000 (00:18 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Aug 2015 20:53:39 +0000 (13:53 -0700)
The change removes redundant sysfs binary file boundary checks, since
this task is already done on caller side in fs/sysfs/file.c

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/ds1682.c

index b909fb30232adbdc3771c8b2154d906a23e7269c..c7112276a039c755289f943e313a95ea5de39f37 100644 (file)
@@ -148,12 +148,6 @@ static ssize_t ds1682_eeprom_read(struct file *filp, struct kobject *kobj,
        dev_dbg(&client->dev, "ds1682_eeprom_read(p=%p, off=%lli, c=%zi)\n",
                buf, off, count);
 
-       if (off >= DS1682_EEPROM_SIZE)
-               return 0;
-
-       if (off + count > DS1682_EEPROM_SIZE)
-               count = DS1682_EEPROM_SIZE - off;
-
        rc = i2c_smbus_read_i2c_block_data(client, DS1682_REG_EEPROM + off,
                                           count, buf);
        if (rc < 0)
@@ -171,12 +165,6 @@ static ssize_t ds1682_eeprom_write(struct file *filp, struct kobject *kobj,
        dev_dbg(&client->dev, "ds1682_eeprom_write(p=%p, off=%lli, c=%zi)\n",
                buf, off, count);
 
-       if (off >= DS1682_EEPROM_SIZE)
-               return -ENOSPC;
-
-       if (off + count > DS1682_EEPROM_SIZE)
-               count = DS1682_EEPROM_SIZE - off;
-
        /* Write out to the device */
        if (i2c_smbus_write_i2c_block_data(client, DS1682_REG_EEPROM + off,
                                           count, buf) < 0)