From: Huang, Tao Date: Thu, 12 Mar 2015 07:48:12 +0000 (+0800) Subject: rtc: HYM8563: don't call rtc_year_days X-Git-Tag: firefly_0821_release~4158^2~370 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9a742e52b1784553b3932eae8970bf96c26e8402;p=firefly-linux-kernel-4.4.55.git rtc: HYM8563: don't call rtc_year_days If i2c error, the driver may call rtc_year_days with month -1, which will cause crash. Fix this by never call rtc_year_days at all. Signed-off-by: Huang, Tao --- diff --git a/drivers/rtc/rtc-HYM8563.c b/drivers/rtc/rtc-HYM8563.c index c20f4b867bfe..056bd3e050d5 100755 --- a/drivers/rtc/rtc-HYM8563.c +++ b/drivers/rtc/rtc-HYM8563.c @@ -227,7 +227,6 @@ static int hym8563_read_datetime(struct i2c_client *client, struct rtc_time *tm) else tm->tm_year += 2000; - tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); tm->tm_year -= 1900; //inorder to cooperate the systerm time if(tm->tm_year < 0) tm->tm_year = 0;