linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] rtc: initialize rtc name early
@ 2015-03-28 21:09 Aaro Koskinen
  2015-03-28 21:09 ` [PATCH 2/3] rtc: __rtc_read_time: reduce log level Aaro Koskinen
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Aaro Koskinen @ 2015-03-28 21:09 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni, rtc-linux
  Cc: linux-kernel, Aaro Koskinen

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>
---
 drivers/rtc/class.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 472a5ad..014ecbc 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -225,15 +225,15 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
 	rtc->pie_timer.function = rtc_pie_update_irq;
 	rtc->pie_enabled = 0;
 
+	strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
+	dev_set_name(&rtc->dev, "rtc%d", id);
+
 	/* Check to see if there is an ALARM already set in hw */
 	err = __rtc_read_alarm(rtc, &alrm);
 
 	if (!err && !rtc_valid_tm(&alrm.time))
 		rtc_initialize_alarm(rtc, &alrm);
 
-	strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE);
-	dev_set_name(&rtc->dev, "rtc%d", id);
-
 	rtc_dev_prepare(rtc);
 
 	err = device_register(&rtc->dev);
-- 
2.2.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-04-05 10:17 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-28 21:09 [PATCH 1/3] rtc: initialize rtc name early Aaro Koskinen
2015-03-28 21:09 ` [PATCH 2/3] rtc: __rtc_read_time: reduce log level Aaro Koskinen
2015-04-01  3:21   ` Alexandre Belloni
2015-04-01  3:25     ` Joe Perches
2015-04-01  9:55       ` Alexandre Belloni
2015-03-28 21:09 ` [PATCH 3/3] rtc: hctosys: use function name in the error log Aaro Koskinen
2015-04-01  3:01   ` Alexandre Belloni
2015-04-01  3:18     ` Joe Perches
2015-04-01  7:05       ` [rtc-linux] " Alessandro Zummo
2015-04-01  7:15         ` Joe Perches
2015-04-01 10:42       ` Alexandre Belloni
2015-04-01 16:12         ` [PATCH] rtc: Use more standard kernel logging styles Joe Perches
2015-04-02  7:47           ` [rtc-linux] " Krzysztof Kozlowski
2015-04-05 10:17           ` Alexandre Belloni
2015-04-01  3:01 ` [PATCH 1/3] rtc: initialize rtc name early Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).