diff options
author | Denis Osterland <Denis.Osterland@diehl.com> | 2018-03-05 05:43:53 -0500 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-03-17 09:20:54 -0400 |
commit | 236b7187034e87bd46eb535ab4f276267ef66ee4 (patch) | |
tree | 243b57c8a3bb2dc384b3d0ecf25c21ff84540a2e | |
parent | 9d327c2d929161a6ca4d7ca0672414cc72100659 (diff) |
rtc: isl1208: switch to rtc_register_device
Fix possible race condition.
It is not allowed to return with an error code after RTC is registered.
Suggested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
Reviewed-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r-- | drivers/rtc/rtc-isl1208.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index a13a4ba79004..1a2c38cc0178 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c | |||
@@ -635,12 +635,12 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
635 | if (isl1208_i2c_validate_client(client) < 0) | 635 | if (isl1208_i2c_validate_client(client) < 0) |
636 | return -ENODEV; | 636 | return -ENODEV; |
637 | 637 | ||
638 | rtc = devm_rtc_device_register(&client->dev, isl1208_driver.driver.name, | 638 | rtc = devm_rtc_allocate_device(&client->dev); |
639 | &isl1208_rtc_ops, | ||
640 | THIS_MODULE); | ||
641 | if (IS_ERR(rtc)) | 639 | if (IS_ERR(rtc)) |
642 | return PTR_ERR(rtc); | 640 | return PTR_ERR(rtc); |
643 | 641 | ||
642 | rtc->ops = &isl1208_rtc_ops; | ||
643 | |||
644 | i2c_set_clientdata(client, rtc); | 644 | i2c_set_clientdata(client, rtc); |
645 | 645 | ||
646 | rc = isl1208_i2c_get_sr(client); | 646 | rc = isl1208_i2c_get_sr(client); |
@@ -674,7 +674,7 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
674 | } | 674 | } |
675 | } | 675 | } |
676 | 676 | ||
677 | return 0; | 677 | return rtc_register_device(rtc); |
678 | } | 678 | } |
679 | 679 | ||
680 | static int | 680 | static int |