diff options
author | Gregory Hermant <gregory.hermant@calao-systems.com> | 2014-04-03 17:50:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:21:24 -0400 |
commit | 67ab2440b40610b3b91068844640df6d3de3464f (patch) | |
tree | b8f1caccb6e01ce33557b63c1615883f0ea985f7 /drivers/rtc/rtc-rv3029c2.c | |
parent | 617b26a0e1cf8f183328763b6f1a33a422b60614 (diff) |
drivers/rtc/rtc-rv3029c2.c: fix potential race condition
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>
Diffstat (limited to 'drivers/rtc/rtc-rv3029c2.c')
-rw-r--r-- | drivers/rtc/rtc-rv3029c2.c | 12 |
1 files changed, 6 insertions, 6 deletions
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, | |||
395 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_EMUL)) | 395 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_EMUL)) |
396 | return -ENODEV; | 396 | return -ENODEV; |
397 | 397 | ||
398 | rc = rv3029c2_i2c_get_sr(client, buf); | ||
399 | if (rc < 0) { | ||
400 | dev_err(&client->dev, "reading status failed\n"); | ||
401 | return rc; | ||
402 | } | ||
403 | |||
398 | rtc = devm_rtc_device_register(&client->dev, client->name, | 404 | rtc = devm_rtc_device_register(&client->dev, client->name, |
399 | &rv3029c2_rtc_ops, THIS_MODULE); | 405 | &rv3029c2_rtc_ops, THIS_MODULE); |
400 | 406 | ||
@@ -403,12 +409,6 @@ static int rv3029c2_probe(struct i2c_client *client, | |||
403 | 409 | ||
404 | i2c_set_clientdata(client, rtc); | 410 | i2c_set_clientdata(client, rtc); |
405 | 411 | ||
406 | rc = rv3029c2_i2c_get_sr(client, buf); | ||
407 | if (rc < 0) { | ||
408 | dev_err(&client->dev, "reading status failed\n"); | ||
409 | return rc; | ||
410 | } | ||
411 | |||
412 | return 0; | 412 | return 0; |
413 | } | 413 | } |
414 | 414 | ||