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

rtc: ds1742: clean up ds1742_nvram_read()/ds1742_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>

authored by

Vladimir Zapolskiy and committed by
Alexandre Belloni
c472d7de a9118d77

+2 -2
+2 -2
drivers/rtc/rtc-ds1742.c
··· 134 134 void __iomem *ioaddr = pdata->ioaddr_nvram; 135 135 ssize_t count; 136 136 137 - for (count = 0; size > 0 && pos < pdata->size_nvram; count++, size--) 137 + for (count = 0; count < size; count++) 138 138 *buf++ = readb(ioaddr + pos++); 139 139 return count; 140 140 } ··· 149 149 void __iomem *ioaddr = pdata->ioaddr_nvram; 150 150 ssize_t count; 151 151 152 - for (count = 0; size > 0 && pos < pdata->size_nvram; count++, size--) 152 + for (count = 0; count < size; count++) 153 153 writeb(*buf++, ioaddr + pos++); 154 154 return count; 155 155 }