Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Vladimir Zapolskiy and committed by
Alexandre Belloni
273e0304 a3781639

-18
-18
drivers/rtc/rtc-ds1305.c
··· 538 538 539 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 541 addr = DS1305_NVRAM + off; 551 542 msg_init(&m, x, &addr, count, NULL, buf); 552 543 ··· 559 568 int status; 560 569 561 570 spi = container_of(kobj, struct spi_device, dev.kobj); 562 - 563 - if (unlikely(off >= DS1305_NVRAM_LEN)) 564 - return -EFBIG; 565 - if (count >= DS1305_NVRAM_LEN) 566 - count = DS1305_NVRAM_LEN; 567 - if ((off + count) > DS1305_NVRAM_LEN) 568 - count = DS1305_NVRAM_LEN - off; 569 - if (unlikely(!count)) 570 - return count; 571 571 572 572 addr = (DS1305_WRITE | DS1305_NVRAM) + off; 573 573 msg_init(&m, x, &addr, count, buf, NULL);