Commit 67ab2440 authored by Gregory Hermant's avatar Gregory Hermant Committed by Linus Torvalds

drivers/rtc/rtc-rv3029c2.c: fix potential race condition

RTC drivers must not return an error after device registration.
Signed-off-by: default avatarGregory Hermant <gregory.hermant@calao-systems.com>
Acked-by: default avatarAlessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 617b26a0
...@@ -395,6 +395,12 @@ static int rv3029c2_probe(struct i2c_client *client, ...@@ -395,6 +395,12 @@ static int rv3029c2_probe(struct i2c_client *client,
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_EMUL)) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_EMUL))
return -ENODEV; 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, rtc = devm_rtc_device_register(&client->dev, client->name,
&rv3029c2_rtc_ops, THIS_MODULE); &rv3029c2_rtc_ops, THIS_MODULE);
...@@ -403,12 +409,6 @@ static int rv3029c2_probe(struct i2c_client *client, ...@@ -403,12 +409,6 @@ static int rv3029c2_probe(struct i2c_client *client,
i2c_set_clientdata(client, rtc); 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment