Re: [PATCH 2/9] add support for the TI VLYNQ bus

From: Ralf Baechle
Date: Tue Jun 02 2009 - 07:13:24 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/