aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1305.c
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vz@mleia.com>2015-07-26 17:48:27 -0400
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-09-05 07:19:09 -0400
commit273e03041e6d48024a57682cbf7b61510f74ec64 (patch)
treeca4873978cd75865f423efb522b6326f41704caa /drivers/rtc/rtc-ds1305.c
parenta3781639e148497d7381d8786aaefe9f8b7e3028 (diff)
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 <vz@mleia.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc/rtc-ds1305.c')
-rw-r--r--drivers/rtc/rtc-ds1305.c18
1 files changed, 0 insertions, 18 deletions
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,
538 538
539 spi = container_of(kobj, struct spi_device, dev.kobj); 539 spi = container_of(kobj, struct spi_device, dev.kobj);
540 540
541 if (unlikely(off >= DS1305_NVRAM_LEN))
542 return 0;
543 if (count >= DS1305_NVRAM_LEN)
544 count = DS1305_NVRAM_LEN;
545 if ((off + count) > DS1305_NVRAM_LEN)
546 count = DS1305_NVRAM_LEN - off;
547 if (unlikely(!count))
548 return count;
549
550 addr = DS1305_NVRAM + off; 541 addr = DS1305_NVRAM + off;
551 msg_init(&m, x, &addr, count, NULL, buf); 542 msg_init(&m, x, &addr, count, NULL, buf);
552 543
@@ -569,15 +560,6 @@ ds1305_nvram_write(struct file *filp, struct kobject *kobj,
569 560
570 spi = container_of(kobj, struct spi_device, dev.kobj); 561 spi = container_of(kobj, struct spi_device, dev.kobj);
571 562
572 if (unlikely(off >= DS1305_NVRAM_LEN))
573 return -EFBIG;
574 if (count >= DS1305_NVRAM_LEN)
575 count = DS1305_NVRAM_LEN;
576 if ((off + count) > DS1305_NVRAM_LEN)
577 count = DS1305_NVRAM_LEN - off;
578 if (unlikely(!count))
579 return count;
580
581 addr = (DS1305_WRITE | DS1305_NVRAM) + off; 563 addr = (DS1305_WRITE | DS1305_NVRAM) + off;
582 msg_init(&m, x, &addr, count, buf, NULL); 564 msg_init(&m, x, &addr, count, buf, NULL);
583 565