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 label. Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx> --- drivers/rtc/rtc-rs5c372.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 3bd6eaa0dcf6..d554c891706b 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c @@ -631,19 +631,15 @@ static int rs5c372_probe(struct i2c_client *client, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_I2C_BLOCK)) smbus_mode = 1; - else { + else /* Still no good, give up */ - err = -ENODEV; - goto exit; - } + return -ENODEV; } rs5c372 = devm_kzalloc(&client->dev, sizeof(struct rs5c372), GFP_KERNEL); - if (!rs5c372) { - err = -ENOMEM; - goto exit; - } + if (!rs5c372) + return -ENOMEM; rs5c372->client = client; i2c_set_clientdata(client, rs5c372); @@ -659,7 +655,7 @@ static int rs5c372_probe(struct i2c_client *client, err = rs5c_get_regs(rs5c372); if (err < 0) - goto exit; + return err; /* clock may be set for am/pm or 24 hr time */ switch (rs5c372->type) { @@ -683,7 +679,7 @@ static int rs5c372_probe(struct i2c_client *client, break; default: dev_err(&client->dev, "unknown RTC type\n"); - goto exit; + return err; } /* if the oscillator lost power and no other software (like @@ -695,7 +691,7 @@ static int rs5c372_probe(struct i2c_client *client, err = rs5c_oscillator_setup(rs5c372); if (unlikely(err < 0)) { dev_err(&client->dev, "setup error\n"); - goto exit; + return err; } dev_info(&client->dev, "%s found, %s\n", @@ -712,23 +708,17 @@ static int rs5c372_probe(struct i2c_client *client, ); /* REVISIT use client->irq to register alarm irq ... */ - rs5c372->rtc = devm_rtc_device_register(&client->dev, - rs5c372_driver.driver.name, - &rs5c372_rtc_ops, THIS_MODULE); + rs5c372->rtc = devm_rtc_allocate_device(&client->dev); + if (IS_ERR(rs5c372->rtc)) + return PTR_ERR(rs5c372->rtc); - if (IS_ERR(rs5c372->rtc)) { - err = PTR_ERR(rs5c372->rtc); - goto exit; - } + rs5c372->rtc->ops = &rs5c372_rtc_ops; err = rs5c_sysfs_register(&client->dev); if (err) - goto exit; - - return 0; + return err; -exit: - return err; + return devm_rtc_register_device(rs5c372->rtc); } static int rs5c372_remove(struct i2c_client *client) -- 2.29.1