From: Vladimir Zapolskiy Date: Sun, 26 Jul 2015 21:48:27 +0000 (+0300) Subject: rtc: ds1305: clean up ds1305_nvram_read()/ds1305_nvram_write() X-Git-Tag: firefly_0821_release~176^2~1112^2~50 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=273e03041e6d48024a57682cbf7b61510f74ec64;p=firefly-linux-kernel-4.4.55.git rtc: ds1305: clean up ds1305_nvram_read()/ds1305_nvram_write() The change removes redundant sysfs binary file boundary checks, since this task is already done on caller size in fs/sysfs/file.c Signed-off-by: Vladimir Zapolskiy Signed-off-by: Alexandre Belloni --- diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c index 12b07158a366..baa5d047f9c8 100644 --- a/drivers/rtc/rtc-ds1305.c +++ b/drivers/rtc/rtc-ds1305.c @@ -538,15 +538,6 @@ ds1305_nvram_read(struct file *filp, struct kobject *kobj, spi = container_of(kobj, struct spi_device, dev.kobj); - if (unlikely(off >= DS1305_NVRAM_LEN)) - return 0; - if (count >= DS1305_NVRAM_LEN) - count = DS1305_NVRAM_LEN; - if ((off + count) > DS1305_NVRAM_LEN) - count = DS1305_NVRAM_LEN - off; - if (unlikely(!count)) - return count; - addr = DS1305_NVRAM + off; msg_init(&m, x, &addr, count, NULL, buf); @@ -569,15 +560,6 @@ ds1305_nvram_write(struct file *filp, struct kobject *kobj, spi = container_of(kobj, struct spi_device, dev.kobj); - if (unlikely(off >= DS1305_NVRAM_LEN)) - return -EFBIG; - if (count >= DS1305_NVRAM_LEN) - count = DS1305_NVRAM_LEN; - if ((off + count) > DS1305_NVRAM_LEN) - count = DS1305_NVRAM_LEN - off; - if (unlikely(!count)) - return count; - addr = (DS1305_WRITE | DS1305_NVRAM) + off; msg_init(&m, x, &addr, count, buf, NULL);