lkml.org 
[lkml]   [2006]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: get_device in device_create_file
    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
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-08-02 23:51    [W:0.027 / U:32.528 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site