]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
rtc: rv8803: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 12 Feb 2018 22:47:33 +0000 (23:47 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 1 Mar 2018 09:49:23 +0000 (10:49 +0100)
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>
drivers/rtc/rtc-rv8803.c

index 6fb5041f750b3e33873285e9e0527adb0b9da7f2..29fc3d210392387ec27814500fcc215a3c838682 100644 (file)
@@ -590,14 +590,6 @@ static int rv8803_probe(struct i2c_client *client,
                }
        }
 
-       rv8803->rtc->ops = &rv8803_rtc_ops;
-       rv8803->rtc->nvram_old_abi = true;
-       err = rtc_register_device(rv8803->rtc);
-       if (err)
-               return err;
-
-       rtc_nvmem_register(rv8803->rtc, &nvmem_cfg);
-
        err = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA);
        if (err)
                return err;
@@ -608,6 +600,14 @@ static int rv8803_probe(struct i2c_client *client,
                return err;
        }
 
+       rv8803->rtc->ops = &rv8803_rtc_ops;
+       rv8803->rtc->nvram_old_abi = true;
+       err = rtc_register_device(rv8803->rtc);
+       if (err)
+               return err;
+
+       rtc_nvmem_register(rv8803->rtc, &nvmem_cfg);
+
        rv8803->rtc->max_user_freq = 1;
 
        return 0;