public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Greg KH <gregkh@suse.de>
Cc: Rahul Ruikar <rahul.ruikar@gmail.com>,
	David Brownell <dbrownell@users.sourceforge.net>,
	nm127@freemail.hu, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RESEND/PATCH] usb: gadget: goku_udc: Fix error path
Date: Tue, 5 Oct 2010 18:53:48 +0200	[thread overview]
Message-ID: <20101005165348.GI5692@bicker> (raw)
In-Reply-To: <20101005132005.GB3548@suse.de>

On Tue, Oct 05, 2010 at 06:20:05AM -0700, Greg KH wrote:
> On Mon, Oct 04, 2010 at 02:22:14PM +0200, Dan Carpenter wrote:
> > On Mon, Oct 04, 2010 at 01:29:00AM +0530, Rahul Ruikar wrote:
> > > call put_device() when device_register() fails.
> > > 
> > 
> > Sorry I didn't realize what you were trying to do here.  This is not
> > correct at all.
> > 
> > The right thing is to fix device_register() to call put_device() itself.
> > It's a bit involved, because all the callers will need to be audited but
> > someone is working on this I think.
> 
> No, no one is working on this, and no, it's not possible to make this
> type of change to the driver core as discussed in the past due to the
> way struct device can be embedded within another structure.

Sorry I guess I lost track of the discussion.  We could write a helper
macro which added the extra put device on failure?  Isn't that the more
common case anyway?  To be honest, I'm still not clear on when the extra
put_device() is appropriate and when it's not.  :/  I'll look through
the archive.

Anyway, I would prefer a slightly different patch.  The logic is easier
to follow if we keep the put_device() right next to the
device_register().  Also if we keep it in one function and we add a
helper macro later then coccinelle can rewrite it automatically.

I'll send my patch.

regards,
dan carpenter

  reply	other threads:[~2010-10-05 16:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-03 19:59 [RESEND/PATCH] usb: gadget: goku_udc: Fix error path Rahul Ruikar
2010-10-04 12:22 ` Dan Carpenter
2010-10-04 13:24   ` Rahul Ruikar
2010-10-04 14:10     ` Dan Carpenter
2010-10-05 13:20   ` Greg KH
2010-10-05 16:53     ` Dan Carpenter [this message]
2010-10-05 16:55     ` [PATCH] " Dan Carpenter

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=20101005165348.GI5692@bicker \
    --to=error27@gmail.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nm127@freemail.hu \
    --cc=rahul.ruikar@gmail.com \
    /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