From 236b7187034e87bd46eb535ab4f276267ef66ee4 Mon Sep 17 00:00:00 2001 From: Denis Osterland Date: Mon, 5 Mar 2018 10:43:53 +0000 Subject: [PATCH] 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 Signed-off-by: Denis Osterland Reviewed-by: Michael Grzeschik Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-isl1208.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index a13a4ba..1a2c38c 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) if (isl1208_i2c_validate_client(client) < 0) return -ENODEV; - rtc = devm_rtc_device_register(&client->dev, isl1208_driver.driver.name, - &isl1208_rtc_ops, - THIS_MODULE); + rtc = devm_rtc_allocate_device(&client->dev); if (IS_ERR(rtc)) return PTR_ERR(rtc); + rtc->ops = &isl1208_rtc_ops; + i2c_set_clientdata(client, rtc); rc = isl1208_i2c_get_sr(client); @@ -674,7 +674,7 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) } } - return 0; + return rtc_register_device(rtc); } static int -- 2.7.4