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>
This commit is contained in:
Родитель
a3781639e1
Коммит
273e03041e
|
@ -538,15 +538,6 @@ ds1305_nvram_read(struct file *filp, struct kobject *kobj,
|
||||||
|
|
||||||
spi = container_of(kobj, struct spi_device, dev.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;
|
addr = DS1305_NVRAM + off;
|
||||||
msg_init(&m, x, &addr, count, NULL, buf);
|
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);
|
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;
|
addr = (DS1305_WRITE | DS1305_NVRAM) + off;
|
||||||
msg_init(&m, x, &addr, count, buf, NULL);
|
msg_init(&m, x, &addr, count, buf, NULL);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче