rtc: rx8010: return meaningful value for RTC_VL_READ

RX8010_FLAG_VLF means the voltage dropped too low and data has been lost.

Link: https://lore.kernel.org/r/20191214220259.621996-18-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
Alexandre Belloni 2019-12-14 23:02:59 +01:00
Родитель 894b043200
Коммит 8049c11399
1 изменённых файлов: 2 добавлений и 5 удалений

Просмотреть файл

@ -399,11 +399,8 @@ static int rx8010_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
if (flagreg < 0) if (flagreg < 0)
return flagreg; return flagreg;
tmp = !!(flagreg & RX8010_FLAG_VLF); tmp = flagreg & RX8010_FLAG_VLF ? RTC_VL_DATA_INVALID : 0;
if (copy_to_user((void __user *)arg, &tmp, sizeof(int))) return put_user(tmp, (unsigned int __user *)arg);
return -EFAULT;
return 0;
default: default:
return -ENOIOCTLCMD; return -ENOIOCTLCMD;