Commit 3e1d9c6f authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Sebastian Reichel

power: olpc_battery: clean up eeprom read function

The change removes redundant sysfs binary file boundary check while
reading eeprom content from userspace, the check is done on caller
side in fs/sysfs/file.c, if binary attribute size is not zero.
Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
parent 9f28b865
...@@ -521,11 +521,6 @@ static ssize_t olpc_bat_eeprom_read(struct file *filp, struct kobject *kobj, ...@@ -521,11 +521,6 @@ static ssize_t olpc_bat_eeprom_read(struct file *filp, struct kobject *kobj,
int ret; int ret;
int i; int i;
if (off >= EEPROM_SIZE)
return 0;
if (off + count > EEPROM_SIZE)
count = EEPROM_SIZE - off;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
ec_byte = EEPROM_START + off + i; ec_byte = EEPROM_START + off + i;
ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &buf[i], 1); ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &buf[i], 1);
...@@ -545,7 +540,7 @@ static struct bin_attribute olpc_bat_eeprom = { ...@@ -545,7 +540,7 @@ static struct bin_attribute olpc_bat_eeprom = {
.name = "eeprom", .name = "eeprom",
.mode = S_IRUGO, .mode = S_IRUGO,
}, },
.size = 0, .size = EEPROM_SIZE,
.read = olpc_bat_eeprom_read, .read = olpc_bat_eeprom_read,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment