Skip to content

Commit

Permalink
i2c: slave eeprom: clean up sysfs bin attribute read()/write()
Browse files Browse the repository at this point in the history
The change removes redundant sysfs binary file boundary checks,
since this task is already done on caller side in fs/sysfs/file.c

Note, on file size overflow read() now returns 0, and this is a
correct and expected EOF notification according to POSIX.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
vzapolskiy authored and Wolfram Sang committed Jul 31, 2015
1 parent bc0195a commit 1f02329
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions drivers/i2c/i2c-slave-eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ static ssize_t i2c_slave_eeprom_bin_read(struct file *filp, struct kobject *kobj
struct eeprom_data *eeprom;
unsigned long flags;

if (off + count > attr->size)
return -EFBIG;

eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));

spin_lock_irqsave(&eeprom->buffer_lock, flags);
Expand All @@ -98,9 +95,6 @@ static ssize_t i2c_slave_eeprom_bin_write(struct file *filp, struct kobject *kob
struct eeprom_data *eeprom;
unsigned long flags;

if (off + count > attr->size)
return -EFBIG;

eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));

spin_lock_irqsave(&eeprom->buffer_lock, flags);
Expand Down

0 comments on commit 1f02329

Please sign in to comment.