Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: ds1682: clean up ds1682_eeprom_read() and ds1682_eeprom_write()

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>

authored by

Vladimir Zapolskiy and committed by
Greg Kroah-Hartman
2b6e5ba3 acb921a5

-12
-12
drivers/misc/ds1682.c
··· 148 148 dev_dbg(&client->dev, "ds1682_eeprom_read(p=%p, off=%lli, c=%zi)\n", 149 149 buf, off, count); 150 150 151 - if (off >= DS1682_EEPROM_SIZE) 152 - return 0; 153 - 154 - if (off + count > DS1682_EEPROM_SIZE) 155 - count = DS1682_EEPROM_SIZE - off; 156 - 157 151 rc = i2c_smbus_read_i2c_block_data(client, DS1682_REG_EEPROM + off, 158 152 count, buf); 159 153 if (rc < 0) ··· 164 170 165 171 dev_dbg(&client->dev, "ds1682_eeprom_write(p=%p, off=%lli, c=%zi)\n", 166 172 buf, off, count); 167 - 168 - if (off >= DS1682_EEPROM_SIZE) 169 - return -ENOSPC; 170 - 171 - if (off + count > DS1682_EEPROM_SIZE) 172 - count = DS1682_EEPROM_SIZE - off; 173 173 174 174 /* Write out to the device */ 175 175 if (i2c_smbus_write_i2c_block_data(client, DS1682_REG_EEPROM + off,