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

rtc: ds1553: clean up ds1553_nvram_read()/ds1553_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
a9118d77 8ccba142

+2 -2
+2 -2
drivers/rtc/rtc-ds1553.c
··· 245 245 void __iomem *ioaddr = pdata->ioaddr; 246 246 ssize_t count; 247 247 248 - for (count = 0; size > 0 && pos < RTC_OFFSET; count++, size--) 248 + for (count = 0; count < size; count++) 249 249 *buf++ = readb(ioaddr + pos++); 250 250 return count; 251 251 } ··· 260 260 void __iomem *ioaddr = pdata->ioaddr; 261 261 ssize_t count; 262 262 263 - for (count = 0; size > 0 && pos < RTC_OFFSET; count++, size--) 263 + for (count = 0; count < size; count++) 264 264 writeb(*buf++, ioaddr + pos++); 265 265 return count; 266 266 }