Commit 8049c113 authored by Alexandre Belloni's avatar Alexandre Belloni

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.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 894b0432
......@@ -399,11 +399,8 @@ static int rx8010_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
if (flagreg < 0)
return flagreg;
tmp = !!(flagreg & RX8010_FLAG_VLF);
if (copy_to_user((void __user *)arg, &tmp, sizeof(int)))
return -EFAULT;
return 0;
tmp = flagreg & RX8010_FLAG_VLF ? RTC_VL_DATA_INVALID : 0;
return put_user(tmp, (unsigned int __user *)arg);
default:
return -ENOIOCTLCMD;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment