rtc: rtc-ds1307: use devm_*() functions
Quoted 2 lines · Devendra Naga
Quoted 1 line · Nikolay Balandin
From: Nikolay Balandin <[email protected]>
[.....]
Quoted 4 lines
Review
Quoted 4 lines
(quoted diff) +1
-1- ds1307->rtc = rtc_device_register(client->name, &client->dev, + ds1307->rtc = devm_rtc_device_register(&client->dev, client->name, &ds13xx_rtc_ops, THIS_MODULE);
Hi Nikolay Baladin, Devendra Naga,
Here, "devm"_rtc_device_register() is used.
Thus, rtc_device_unregister() will be called after remove() or on probe failure.
Quoted 7 lines
Quoted 7 lines
if (IS_ERR(ds1307->rtc)) { err = PTR_ERR(ds1307->rtc); dev_err(&client->dev, "unable to register the class device\n");(quoted diff) +1
-1- goto exit_free; + return err; }
[.....]
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +0
-3-exit_nvram: -exit_irq: - rtc_device_unregister(ds1307->rtc);Please dont remove this unregister, there's no devm_* for the rtc subsystem.
Above mentioned, rtc_device_unregister() can be removed, because "devm"_rtc_device_register() was already called.
If I am wrong, please let me know kindly. :)
See you.
Best regards,
Jingoo Han
Quoted 23 lines
Quoted 9 lines
(quoted diff) +0
-3-exit_free: - kfree(ds1307); - return err; } static int ds1307_remove(struct i2c_client *client)Review static int ds1307_remove(struct i2c_client *client) · line 1000
Quoted 10 lines
(quoted diff) +1
-4@@ -992,13 +981,9 @@ static int ds1307_remove(struct i2c_client *client) cancel_work_sync(&ds1307->work); } - if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags)) { + if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags)) sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram); - kfree(ds1307->nvram); - } - rtc_device_unregister(ds1307->rtc);Here too.
Quoted 11 lines · Jingoo Han
Quoted 2 lines · Devendra Naga
Quoted 1 line · Nikolay Balandin
From: Nikolay Balandin <[email protected]>
[.....]
Quoted 4 lines
Review
Quoted 4 lines
(quoted diff) +1
-1- ds1307->rtc = rtc_device_register(client->name, &client->dev, + ds1307->rtc = devm_rtc_device_register(&client->dev, client->name, &ds13xx_rtc_ops, THIS_MODULE);
Quoted 6 lines
Hi Nikolay Baladin, Devendra Naga,
Here, "devm"_rtc_device_register() is used.
Thus,rtc_device_unregister()will be called afterremove()or on probe failure.
You are correct, I am not aware of the new API that is added by you in c100a5e0255.
Very sorry Nikolay Baladin, I would really have seen and commented on the patch.
Thanks for letting me know. :)
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
if (IS_ERR(ds1307->rtc)) {