From: Jingoo Han <jg1.han@samsung.com>
To: "'Nikolay Balandin'" <nbalandin@dev.rtsoft.ru>,
"'Devendra Naga'" <devendra.aaru@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"'Alessandro Zummo'" <a.zummo@towertech.it>,
rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org,
Jingoo Han <jg1.han@samsung.com>
Subject: Re: [PATCH 1/1] rtc: rtc-ds1307: use devm_*() functions
Date: Mon, 27 May 2013 10:02:40 +0900 [thread overview]
Message-ID: <000401ce5a75$e32ffed0$a98ffc70$@samsung.com> (raw)
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 <nbalandin@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.
>
>
next reply other threads:[~2013-05-27 1:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-27 1:02 Jingoo Han [this message]
2013-05-27 4:21 ` [PATCH 1/1] rtc: rtc-ds1307: use devm_*() functions devendra.aaru
-- strict thread matches above, loose matches on Subject: below --
2013-05-25 15:54 Nikolay Balandin
2013-05-25 14:41 Nikolay Balandin
2013-05-25 14:51 ` devendra.aaru
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000401ce5a75$e32ffed0$a98ffc70$@samsung.com' \
--to=jg1.han@samsung.com \
--cc=a.zummo@towertech.it \
--cc=akpm@linux-foundation.org \
--cc=devendra.aaru@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nbalandin@dev.rtsoft.ru \
--cc=rtc-linux@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox