Merge tag 'irqchip-fixes-5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / rtc / rtc-pcf8523.c
index b24c908..47e0f41 100644 (file)
@@ -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;
        }