hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/alpha/kernel/rtc.c
....@@ -80,7 +80,12 @@
8080 static int
8181 alpha_rtc_read_time(struct device *dev, struct rtc_time *tm)
8282 {
83
- mc146818_get_time(tm);
83
+ int ret = mc146818_get_time(tm);
84
+
85
+ if (ret < 0) {
86
+ dev_err_ratelimited(dev, "unable to read current time\n");
87
+ return ret;
88
+ }
8489
8590 /* Adjust for non-default epochs. It's easier to depend on the
8691 generic __get_rtc_time and adjust the epoch here than create
....@@ -198,26 +203,24 @@
198203 static int __init
199204 alpha_rtc_init(void)
200205 {
201
- const struct rtc_class_ops *ops;
202206 struct platform_device *pdev;
203207 struct rtc_device *rtc;
204
- const char *name;
205208
206209 init_rtc_epoch();
207
- name = "rtc-alpha";
208
- ops = &alpha_rtc_ops;
209210
210
-#ifdef HAVE_REMOTE_RTC
211
- if (alpha_mv.rtc_boot_cpu_only)
212
- ops = &remote_rtc_ops;
213
-#endif
214
-
215
- pdev = platform_device_register_simple(name, -1, NULL, 0);
216
- rtc = devm_rtc_device_register(&pdev->dev, name, ops, THIS_MODULE);
211
+ pdev = platform_device_register_simple("rtc-alpha", -1, NULL, 0);
212
+ rtc = devm_rtc_allocate_device(&pdev->dev);
217213 if (IS_ERR(rtc))
218214 return PTR_ERR(rtc);
219215
220216 platform_set_drvdata(pdev, rtc);
221
- return 0;
217
+ rtc->ops = &alpha_rtc_ops;
218
+
219
+#ifdef HAVE_REMOTE_RTC
220
+ if (alpha_mv.rtc_boot_cpu_only)
221
+ rtc->ops = &remote_rtc_ops;
222
+#endif
223
+
224
+ return rtc_register_device(rtc);
222225 }
223226 device_initcall(alpha_rtc_init);