summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-pcf8523.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2019-12-14 23:02:47 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-12-18 10:37:25 +0100
commit244cf8f0ed2778e1897b64b9043367b7263f5590 (patch)
treea540af6ef715ef0564ea66d1d072e69b731b6910 /drivers/rtc/rtc-pcf8523.c
parentaf4273116d2ccc6e7712de54169d4a9998d52f8a (diff)
downloadlwn-244cf8f0ed2778e1897b64b9043367b7263f5590.tar.gz
lwn-244cf8f0ed2778e1897b64b9043367b7263f5590.zip
rtc: pcf8523: return meaningful value for RTC_VL_READ
REG_CONTROL3_BLF indicates the battery is low and needs to be replaced soon. Link: https://lore.kernel.org/r/20191214220259.621996-6-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-pcf8523.c')
-rw-r--r--drivers/rtc/rtc-pcf8523.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
index b24c908f5f06..47e0f411dd5c 100644
--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -282,11 +282,11 @@ static int pcf8523_rtc_ioctl(struct device *dev, unsigned int cmd,
ret = pcf8523_voltage_low(client);
if (ret < 0)
return ret;
+ if (ret)
+ ret = RTC_VL_BACKUP_LOW;
- if (copy_to_user((void __user *)arg, &ret, sizeof(int)))
- return -EFAULT;
+ return put_user(ret, (unsigned int __user *)arg);
- return 0;
default:
return -ENOIOCTLCMD;
}