summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-rv8803.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2018-02-12 17:47:33 -0500
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-03-01 04:49:23 -0500
commitce1ae8eb83bee42c5a0dbcc01346e41c6e85da43 (patch)
treea95775bba15fb139d0bccb163729dc831c7c16a0 /drivers/rtc/rtc-rv8803.c
parentc07fd9dea2fab9f4b1f246b766e124606cef187f (diff)
rtc: rv8803: fix possible race condition
The probe function is not allowed to fail after registering the RTC. Call rtc_register_device() at the end. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-rv8803.c')
-rw-r--r--drivers/rtc/rtc-rv8803.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index 6fb5041f750b..29fc3d210392 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -590,14 +590,6 @@ static int rv8803_probe(struct i2c_client *client,
590 } 590 }
591 } 591 }
592 592
593 rv8803->rtc->ops = &rv8803_rtc_ops;
594 rv8803->rtc->nvram_old_abi = true;
595 err = rtc_register_device(rv8803->rtc);
596 if (err)
597 return err;
598
599 rtc_nvmem_register(rv8803->rtc, &nvmem_cfg);
600
601 err = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA); 593 err = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA);
602 if (err) 594 if (err)
603 return err; 595 return err;
@@ -608,6 +600,14 @@ static int rv8803_probe(struct i2c_client *client,
608 return err; 600 return err;
609 } 601 }
610 602
603 rv8803->rtc->ops = &rv8803_rtc_ops;
604 rv8803->rtc->nvram_old_abi = true;
605 err = rtc_register_device(rv8803->rtc);
606 if (err)
607 return err;
608
609 rtc_nvmem_register(rv8803->rtc, &nvmem_cfg);
610
611 rv8803->rtc->max_user_freq = 1; 611 rv8803->rtc->max_user_freq = 1;
612 612
613 return 0; 613 return 0;