Commit 86e655f9 authored by Alexandre Belloni's avatar Alexandre Belloni
Browse files

rtc: rv3028: return meaningful value for RTC_VL_READ

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

Link: https://lore.kernel.org/r/20191214220259.621996-14-alexandre.belloni@bootlin.com


Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 92c02daa
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -428,15 +428,8 @@ static int rv3028_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
		if (ret < 0)
			return ret;

		if (status & RV3028_STATUS_PORF)
			dev_warn(&rv3028->rtc->dev, "Voltage low, data loss detected.\n");

		status &= RV3028_STATUS_PORF;

		if (copy_to_user((void __user *)arg, &status, sizeof(int)))
			return -EFAULT;

		return 0;
		status = status & RV3028_STATUS_PORF ? RTC_VL_DATA_INVALID : 0;
		return put_user(status, (unsigned int __user *)arg);

	default:
		return -ENOIOCTLCMD;