]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drivers/rtc/rtc-rv3029c2.c: fix potential race condition
authorGregory Hermant <gregory.hermant@calao-systems.com>
Thu, 3 Apr 2014 21:50:17 +0000 (14:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Apr 2014 23:21:24 +0000 (16:21 -0700)
RTC drivers must not return an error after device registration.

Signed-off-by: Gregory Hermant <gregory.hermant@calao-systems.com>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-rv3029c2.c

index 1a779a67ff6683567ff9d8dbc40fc7f92ef9767f..e9ac5a43be1a87c2f84f98e3e8d11f0cd922b7bd 100644 (file)
@@ -395,6 +395,12 @@ static int rv3029c2_probe(struct i2c_client *client,
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_EMUL))
                return -ENODEV;
 
+       rc = rv3029c2_i2c_get_sr(client, buf);
+       if (rc < 0) {
+               dev_err(&client->dev, "reading status failed\n");
+               return rc;
+       }
+
        rtc = devm_rtc_device_register(&client->dev, client->name,
                                        &rv3029c2_rtc_ops, THIS_MODULE);
 
@@ -403,12 +409,6 @@ static int rv3029c2_probe(struct i2c_client *client,
 
        i2c_set_clientdata(client, rtc);
 
-       rc = rv3029c2_i2c_get_sr(client, buf);
-       if (rc < 0) {
-               dev_err(&client->dev, "reading status failed\n");
-               return rc;
-       }
-
        return 0;
 }