Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2dbcd05f authored by Jonghwan Choi's avatar Jonghwan Choi Committed by Linus Torvalds
Browse files

drivers/rtc/rtc-s3c.c: fix driver clock enable/disable balance issues



If an error occurs after the clock is enabled, the enable/disable state
can become unbalanced.

Signed-off-by: default avatarJonghwan Choi <jhbird.choi@samsung.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Acked-by: default avatarKukjin Kim <kgene.kim@samsung.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1de8ad43
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -202,7 +202,6 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
	void __iomem *base = s3c_rtc_base;
	void __iomem *base = s3c_rtc_base;
	int year = tm->tm_year - 100;
	int year = tm->tm_year - 100;


	clk_enable(rtc_clk);
	pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n",
	pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n",
		 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday,
		 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday,
		 tm->tm_hour, tm->tm_min, tm->tm_sec);
		 tm->tm_hour, tm->tm_min, tm->tm_sec);
@@ -214,6 +213,7 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
		return -EINVAL;
		return -EINVAL;
	}
	}


	clk_enable(rtc_clk);
	writeb(bin2bcd(tm->tm_sec),  base + S3C2410_RTCSEC);
	writeb(bin2bcd(tm->tm_sec),  base + S3C2410_RTCSEC);
	writeb(bin2bcd(tm->tm_min),  base + S3C2410_RTCMIN);
	writeb(bin2bcd(tm->tm_min),  base + S3C2410_RTCMIN);
	writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR);
	writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR);