From: Gregory Hermant Date: Thu, 3 Apr 2014 21:50:17 +0000 (-0700) Subject: drivers/rtc/rtc-rv3029c2.c: fix potential race condition X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=67ab2440b40610b3b91068844640df6d3de3464f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drivers/rtc/rtc-rv3029c2.c: fix potential race condition RTC drivers must not return an error after device registration. Signed-off-by: Gregory Hermant Acked-by: Alessandro Zummo Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c index 1a779a67ff66..e9ac5a43be1a 100644 --- a/drivers/rtc/rtc-rv3029c2.c +++ b/drivers/rtc/rtc-rv3029c2.c @@ -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; }