From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx> devm_rtc_device_register() is deprecated. Use devm_rtc_allocate_device() and devm_rtc_register_device() pair instead. While at it: remove unnecessary goto label. Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx> --- drivers/rtc/rtc-fm3130.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c index 677ec2da13d8..29e296f2faab 100644 --- a/drivers/rtc/rtc-fm3130.c +++ b/drivers/rtc/rtc-fm3130.c @@ -344,7 +344,6 @@ static int fm3130_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct fm3130 *fm3130; - int err = -ENODEV; int tmp; struct i2c_adapter *adapter = client->adapter; @@ -390,8 +389,7 @@ static int fm3130_probe(struct i2c_client *client, tmp = i2c_transfer(adapter, fm3130->msg, 4); if (tmp != 4) { dev_dbg(&client->dev, "read error %d\n", tmp); - err = -EIO; - goto exit_free; + return -EIO; } fm3130->regs[FM3130_RTC_CONTROL] = @@ -501,17 +499,13 @@ static int fm3130_probe(struct i2c_client *client, /* We won't bail out here because we just got invalid data. Time setting from u-boot doesn't work anyway */ - fm3130->rtc = devm_rtc_device_register(&client->dev, client->name, - &fm3130_rtc_ops, THIS_MODULE); - if (IS_ERR(fm3130->rtc)) { - err = PTR_ERR(fm3130->rtc); - dev_err(&client->dev, - "unable to register the class device\n"); - goto exit_free; - } - return 0; -exit_free: - return err; + fm3130->rtc = devm_rtc_allocate_device(&client->dev); + if (IS_ERR(fm3130->rtc)) + return PTR_ERR(fm3130->rtc); + + fm3130->rtc->ops = &fm3130_rtc_ops; + + return devm_rtc_register_device(fm3130->rtc); } static struct i2c_driver fm3130_driver = { -- 2.29.1