Skip to content

Commit

Permalink
drivers/rtc/rtc-rv3029c2.c: fix potential race condition
Browse files Browse the repository at this point in the history
RTC drivers must not return an error after device registration.

Signed-off-by: Gregory Hermant <[email protected]>
Acked-by: Alessandro Zummo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
ghermant authored and torvalds committed Apr 3, 2014
1 parent 617b26a commit 67ab244
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/rtc/rtc-rv3029c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}

Expand Down

0 comments on commit 67ab244

Please sign in to comment.