We need to unlock if time is more than U32_MAX. Fixes: 83c880f79e88 ("rtc: add mxc driver for i.MX53 SRTC") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c index 9e14efb990b2..90c9ab68688f 100644 --- a/drivers/rtc/rtc-mxc_v2.c +++ b/drivers/rtc/rtc-mxc_v2.c @@ -243,12 +243,14 @@ static int mxc_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) { const time64_t time = rtc_tm_to_time64(&alrm->time); struct mxc_rtc_data *pdata = dev_get_drvdata(dev); - int ret = mxc_rtc_lock(pdata); + int ret; + ret = mxc_rtc_lock(pdata); if (ret) return ret; if (time > U32_MAX) { + mxc_rtc_unlock(pdata); dev_err(dev, "Hopefully I am out of service by then :-(\n"); return -EINVAL; }