lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <000401ce5a75$e32ffed0$a98ffc70$@samsung.com>
Date:	Mon, 27 May 2013 10:02:40 +0900
From:	Jingoo Han <jg1.han@...sung.com>
To:	'Nikolay Balandin' <nbalandin@....rtsoft.ru>,
	'Devendra Naga' <devendra.aaru@...il.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	'Alessandro Zummo' <a.zummo@...ertech.it>,
	rtc-linux@...glegroups.com, linux-kernel@...r.kernel.org,
	Jingoo Han <jg1.han@...sung.com>
Subject: Re: [PATCH 1/1] rtc: rtc-ds1307: use devm_*() functions

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@....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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ