On Saturday, May 25, 2013 10:51 AM, Devendra Naga wrote: > On Sat, May 25, 2013 at 10:41 AM, Nikolay Balandin wrote: > > From: Nikolay Balandin <nbalan...@dev.rtsoft.ru>
[.....] > > > > - 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. > > if (IS_ERR(ds1307->rtc)) { > > err = PTR_ERR(ds1307->rtc); > > dev_err(&client->dev, > > "unable to register the class device\n"); > > - goto exit_free; > > + return err; > > } [.....] > > -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 > > > > -exit_free: > > - kfree(ds1307); > > - return err; > > } > > > > static int ds1307_remove(struct i2c_client *client) > > @@ -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. > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/