diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2015-04-16 15:45:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:01 -0400 |
commit | 182683e955af4dd2324427129f3b90558d644066 (patch) | |
tree | ba963c139a469828833fb49a9ff06d3353af4be1 /drivers/rtc | |
parent | 5281f94ae7f54d2d1a48dbc10223fd12d2aea716 (diff) |
drivers/rtc/class.c: initialize rtc name early
In some error cases RTC name is used before it is initialized:
rtc-rs5c372 0-0032: clock needs to be set
rtc-rs5c372 0-0032: rs5c372b found, 24hr, driver version 0.6
rtc (null): read_time: fail to read
rtc-rs5c372 0-0032: rtc core: registered rtc-rs5c372 as rtc0
Fix by initializing the name early.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/class.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index c29ba7e14304..ea2a315df6b7 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -221,15 +221,15 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
221 | rtc->pie_timer.function = rtc_pie_update_irq; | 221 | rtc->pie_timer.function = rtc_pie_update_irq; |
222 | rtc->pie_enabled = 0; | 222 | rtc->pie_enabled = 0; |
223 | 223 | ||
224 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); | ||
225 | dev_set_name(&rtc->dev, "rtc%d", id); | ||
226 | |||
224 | /* Check to see if there is an ALARM already set in hw */ | 227 | /* Check to see if there is an ALARM already set in hw */ |
225 | err = __rtc_read_alarm(rtc, &alrm); | 228 | err = __rtc_read_alarm(rtc, &alrm); |
226 | 229 | ||
227 | if (!err && !rtc_valid_tm(&alrm.time)) | 230 | if (!err && !rtc_valid_tm(&alrm.time)) |
228 | rtc_initialize_alarm(rtc, &alrm); | 231 | rtc_initialize_alarm(rtc, &alrm); |
229 | 232 | ||
230 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); | ||
231 | dev_set_name(&rtc->dev, "rtc%d", id); | ||
232 | |||
233 | rtc_dev_prepare(rtc); | 233 | rtc_dev_prepare(rtc); |
234 | 234 | ||
235 | err = device_register(&rtc->dev); | 235 | err = device_register(&rtc->dev); |