All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Florian Fainelli <florian@openwrt.org>
Cc: linux-kernel@vger.kernel.org, akpm <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 2/9] add support for the TI VLYNQ bus
Date: Tue, 2 Jun 2009 12:11:45 +0100	[thread overview]
Message-ID: <20090602111145.GA11488@linux-mips.org> (raw)
In-Reply-To: <200906011358.28359.florian@openwrt.org>

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

  parent reply	other threads:[~2009-06-02 11:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01 11:58 [PATCH 2/9] add support for the TI VLYNQ bus Florian Fainelli
2009-06-02  5:08 ` Andrew Morton
2009-06-02  8:30   ` Florian Fainelli
2009-06-04 10:52   ` Florian Fainelli
2009-06-04 11:20     ` Andrew Morton
2009-06-02 11:11 ` Ralf Baechle [this message]
2009-06-08 11:28 ` Suraj Iyer
2009-06-08 11:40   ` Florian Fainelli

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=20090602111145.GA11488@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=akpm@linux-foundation.org \
    --cc=florian@openwrt.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.