aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-rv3029c2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-rv3029c2.c')
-rw-r--r--drivers/rtc/rtc-rv3029c2.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index f8ee8ad7825e..5032c24ec159 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -395,9 +395,8 @@ 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 rtc = rtc_device_register(client->name, 398 rtc = devm_rtc_device_register(&client->dev, client->name,
399 &client->dev, &rv3029c2_rtc_ops, 399 &rv3029c2_rtc_ops, THIS_MODULE);
400 THIS_MODULE);
401 400
402 if (IS_ERR(rtc)) 401 if (IS_ERR(rtc))
403 return PTR_ERR(rtc); 402 return PTR_ERR(rtc);
@@ -407,23 +406,14 @@ static int rv3029c2_probe(struct i2c_client *client,
407 rc = rv3029c2_i2c_get_sr(client, buf); 406 rc = rv3029c2_i2c_get_sr(client, buf);
408 if (rc < 0) { 407 if (rc < 0) {
409 dev_err(&client->dev, "reading status failed\n"); 408 dev_err(&client->dev, "reading status failed\n");
410 goto exit_unregister; 409 return rc;
411 } 410 }
412 411
413 return 0; 412 return 0;
414
415exit_unregister:
416 rtc_device_unregister(rtc);
417
418 return rc;
419} 413}
420 414
421static int rv3029c2_remove(struct i2c_client *client) 415static int rv3029c2_remove(struct i2c_client *client)
422{ 416{
423 struct rtc_device *rtc = i2c_get_clientdata(client);
424
425 rtc_device_unregister(rtc);
426
427 return 0; 417 return 0;
428} 418}
429 419