From: Pete Zaitcev <zaitcev@redhat.com>
To: Dmitry Torokhov <dtor@insightbb.com>
Cc: greg@kroah.com, linux-kernel@vger.kernel.org, zaitcev@redhat.com
Subject: Re: get_device in device_create_file
Date: Wed, 2 Aug 2006 14:49:08 -0700 [thread overview]
Message-ID: <20060802144908.3645e08a.zaitcev@redhat.com> (raw)
In-Reply-To: <200608012113.06191.dtor@insightbb.com>
On Tue, 1 Aug 2006 21:13:05 -0400, Dmitry Torokhov <dtor@insightbb.com> wrote:
> > > if (get_device(dev)) {
> > > error = sysfs_create_file(&dev->kobj, &attr->attr);
> > > put_device(dev);
> > > }
> > Buf it not, and the caller has a reference, then the call to
> > get_device is redundant.
> Yes it is. There are few of redundant gets and puts sprinkled around
> in the driver core, but the last time I mentioned that Greg was not
> quite ready to get rid of them ;)
I see a small, but nonzero harm from keeping them, for two reasons.
One, I reviewed a patch for RHEL-4 today, where the submitter copied
this code without thinking. So, if we don't flush these, they will
proliferate. Hackers assume that if Greg wrote that, it must be the
right way. Two, these calls shrink the race window and may be
masking something.
-- Pete
next prev parent reply other threads:[~2006-08-02 21:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-01 20:25 get_device in device_create_file Pete Zaitcev
2006-08-02 1:13 ` Dmitry Torokhov
2006-08-02 21:49 ` Pete Zaitcev [this message]
2006-08-03 7:52 ` Greg KH
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=20060802144908.3645e08a.zaitcev@redhat.com \
--to=zaitcev@redhat.com \
--cc=dtor@insightbb.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/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