diff options
author | Vladimir Zapolskiy <vz@mleia.com> | 2015-07-26 17:48:26 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2015-09-05 07:19:09 -0400 |
commit | a3781639e148497d7381d8786aaefe9f8b7e3028 (patch) | |
tree | 94e5af36cdd5a57bceb5f91d8c038b23dd584272 /drivers/rtc | |
parent | 3c217e51d8a272b9301058fe845d6c69cc0651cb (diff) |
rtc: cmos: clean up cmos_nvram_read()/cmos_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-cmos.c | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index c2e90c62a59c..8f7034ba7d9e 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -467,13 +467,6 @@ cmos_nvram_read(struct file *filp, struct kobject *kobj, | |||
467 | { | 467 | { |
468 | int retval; | 468 | int retval; |
469 | 469 | ||
470 | if (unlikely(off >= attr->size)) | ||
471 | return 0; | ||
472 | if (unlikely(off < 0)) | ||
473 | return -EINVAL; | ||
474 | if ((off + count) > attr->size) | ||
475 | count = attr->size - off; | ||
476 | |||
477 | off += NVRAM_OFFSET; | 470 | off += NVRAM_OFFSET; |
478 | spin_lock_irq(&rtc_lock); | 471 | spin_lock_irq(&rtc_lock); |
479 | for (retval = 0; count; count--, off++, retval++) { | 472 | for (retval = 0; count; count--, off++, retval++) { |
@@ -498,12 +491,6 @@ cmos_nvram_write(struct file *filp, struct kobject *kobj, | |||
498 | int retval; | 491 | int retval; |
499 | 492 | ||
500 | cmos = dev_get_drvdata(container_of(kobj, struct device, kobj)); | 493 | cmos = dev_get_drvdata(container_of(kobj, struct device, kobj)); |
501 | if (unlikely(off >= attr->size)) | ||
502 | return -EFBIG; | ||
503 | if (unlikely(off < 0)) | ||
504 | return -EINVAL; | ||
505 | if ((off + count) > attr->size) | ||
506 | count = attr->size - off; | ||
507 | 494 | ||
508 | /* NOTE: on at least PCs and Ataris, the boot firmware uses a | 495 | /* NOTE: on at least PCs and Ataris, the boot firmware uses a |
509 | * checksum on part of the NVRAM data. That's currently ignored | 496 | * checksum on part of the NVRAM data. That's currently ignored |