From: Jonghwan Choi Date: Fri, 2 Dec 2011 03:06:48 +0000 (+1100) Subject: drivers/rtc/rtc-s3c.c: fix driver clock enable/disable balance issues X-Git-Tag: next-20111207~2^2~217 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a51fbce6030a6075bfbd57b92200d6269ffc3afc;p=karo-tx-linux.git 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: Jonghwan Choi Cc: Alessandro Zummo Acked-by: Kukjin Kim Cc: Signed-off-by: Andrew Morton --- diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 00248eba4d08..175067a17c46 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -203,7 +203,6 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) void __iomem *base = s3c_rtc_base; int year = tm->tm_year - 100; - clk_enable(rtc_clk); pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n", 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); @@ -215,6 +214,7 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) return -EINVAL; } + clk_enable(rtc_clk); writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC); writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN); writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR);