diff options
author | Vladimir Zapolskiy <vz@mleia.com> | 2015-07-26 17:26:49 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2015-07-27 10:28:54 -0400 |
commit | 3e1d9c6f241961e2e21b8df9de5ee12e3dc6f177 (patch) | |
tree | a4d372e6327efbca685cbb2e7f5baa8556d8485c /drivers/power | |
parent | 9f28b86552aef94733387814a57755cb0019cfb9 (diff) |
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: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/olpc_battery.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c index a944338a39de..9e29b1321648 100644 --- a/drivers/power/olpc_battery.c +++ b/drivers/power/olpc_battery.c | |||
@@ -521,11 +521,6 @@ static ssize_t olpc_bat_eeprom_read(struct file *filp, struct kobject *kobj, | |||
521 | int ret; | 521 | int ret; |
522 | int i; | 522 | int i; |
523 | 523 | ||
524 | if (off >= EEPROM_SIZE) | ||
525 | return 0; | ||
526 | if (off + count > EEPROM_SIZE) | ||
527 | count = EEPROM_SIZE - off; | ||
528 | |||
529 | for (i = 0; i < count; i++) { | 524 | for (i = 0; i < count; i++) { |
530 | ec_byte = EEPROM_START + off + i; | 525 | ec_byte = EEPROM_START + off + i; |
531 | ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &buf[i], 1); | 526 | 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 | .name = "eeprom", | 540 | .name = "eeprom", |
546 | .mode = S_IRUGO, | 541 | .mode = S_IRUGO, |
547 | }, | 542 | }, |
548 | .size = 0, | 543 | .size = EEPROM_SIZE, |
549 | .read = olpc_bat_eeprom_read, | 544 | .read = olpc_bat_eeprom_read, |
550 | }; | 545 | }; |
551 | 546 | ||