All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alessandro Zummo <a.zummo@towertech.it>,
	Patrick Bruenn <p.bruenn@beckhoff.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-rtc@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] rtc: mxc_v2: unlock on error in mxc_rtc_set_alarm()
Date: Wed, 14 Mar 2018 07:37:19 +0000	[thread overview]
Message-ID: <20180314073719.GA2470@mwanda> (raw)

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@oracle.com>

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;
 	}

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alessandro Zummo <a.zummo@towertech.it>,
	Patrick Bruenn <p.bruenn@beckhoff.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-rtc@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] rtc: mxc_v2: unlock on error in mxc_rtc_set_alarm()
Date: Wed, 14 Mar 2018 10:37:19 +0300	[thread overview]
Message-ID: <20180314073719.GA2470@mwanda> (raw)

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@oracle.com>

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;
 	}

             reply	other threads:[~2018-03-14  7:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14  7:37 Dan Carpenter [this message]
2018-03-14  7:37 ` [PATCH] rtc: mxc_v2: unlock on error in mxc_rtc_set_alarm() Dan Carpenter
2018-03-15 11:12 ` Patrick Brünn
2018-03-15 11:12   ` Patrick Brünn
2018-03-15 11:26   ` Dan Carpenter
2018-03-15 11:26     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180314073719.GA2470@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=p.bruenn@beckhoff.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.