lkml.org 
[lkml]   [2009]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/9] add support for the TI VLYNQ bus
    On Mon, Jun 01, 2009 at 01:58:27PM +0200, Florian Fainelli wrote:

    > +static int vlynq_device_probe(struct device *dev)
    > +{
    > + struct vlynq_device *vdev = to_vlynq_device(dev);
    > + struct vlynq_driver *drv = to_vlynq_driver(dev->driver);
    > + struct vlynq_device_id *id = vlynq_get_drvdata(vdev);
    > + int result = -ENODEV;
    > +
    > + get_device(dev);
    > + if (drv && drv->probe)
    > + result = drv->probe(vdev, id);
    > + if (result)
    > + put_device(dev);
    > + return result;
    > +}

    I don't think you need to increment the device reference counter here.
    The caller has already done that.

    > +
    > +static int vlynq_device_remove(struct device *dev)
    > +{
    > + struct vlynq_driver *drv = to_vlynq_driver(dev->driver);
    > + if (drv && drv->remove)
    > + drv->remove(to_vlynq_device(dev));
    > + put_device(dev);
    > + return 0;
    > +}

    And this put_device I think is a bug - the caller should decrement the
    reference.

    Ralf


    \
     
     \ /
      Last update: 2009-06-02 13:17    [W:0.044 / U:1.360 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site