diff options
author | Vladimir Zapolskiy <vz@mleia.com> | 2015-07-26 17:48:28 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2015-09-05 07:19:10 -0400 |
commit | ca7c14d3a1ab1932732c506e32ab5b189b9c0a16 (patch) | |
tree | 45596c223837a0917ad277bd6c9683bf1c08c2fd /drivers/rtc | |
parent | 273e03041e6d48024a57682cbf7b61510f74ec64 (diff) |
rtc: ds1307: clean up ds1307_nvram_read()/ds1307_nvram_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: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-ds1307.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index c51bc0a65afc..a705e6490808 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -782,13 +782,6 @@ ds1307_nvram_read(struct file *filp, struct kobject *kobj, | |||
782 | client = kobj_to_i2c_client(kobj); | 782 | client = kobj_to_i2c_client(kobj); |
783 | ds1307 = i2c_get_clientdata(client); | 783 | ds1307 = i2c_get_clientdata(client); |
784 | 784 | ||
785 | if (unlikely(off >= ds1307->nvram->size)) | ||
786 | return 0; | ||
787 | if ((off + count) > ds1307->nvram->size) | ||
788 | count = ds1307->nvram->size - off; | ||
789 | if (unlikely(!count)) | ||
790 | return count; | ||
791 | |||
792 | result = ds1307->read_block_data(client, ds1307->nvram_offset + off, | 785 | result = ds1307->read_block_data(client, ds1307->nvram_offset + off, |
793 | count, buf); | 786 | count, buf); |
794 | if (result < 0) | 787 | if (result < 0) |
@@ -808,13 +801,6 @@ ds1307_nvram_write(struct file *filp, struct kobject *kobj, | |||
808 | client = kobj_to_i2c_client(kobj); | 801 | client = kobj_to_i2c_client(kobj); |
809 | ds1307 = i2c_get_clientdata(client); | 802 | ds1307 = i2c_get_clientdata(client); |
810 | 803 | ||
811 | if (unlikely(off >= ds1307->nvram->size)) | ||
812 | return -EFBIG; | ||
813 | if ((off + count) > ds1307->nvram->size) | ||
814 | count = ds1307->nvram->size - off; | ||
815 | if (unlikely(!count)) | ||
816 | return count; | ||
817 | |||
818 | result = ds1307->write_block_data(client, ds1307->nvram_offset + off, | 804 | result = ds1307->write_block_data(client, ds1307->nvram_offset + off, |
819 | count, buf); | 805 | count, buf); |
820 | if (result < 0) { | 806 | if (result < 0) { |