public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Rahul Ruikar <rahul.ruikar@gmail.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Joe Perches <joe@perches.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: langwell_udc: Fix error path
Date: Mon, 04 Oct 2010 14:44:20 +0400	[thread overview]
Message-ID: <4CA9B004.3020103@ru.mvista.com> (raw)
In-Reply-To: <1286113750-2607-1-git-send-email-rahul.ruikar@gmail.com>

Hello.

On 03-10-2010 17:49, Rahul Ruikar wrote:

> - call device_unregister() only when device_register() is sucess.

    s/is sucess/succeeds/

> - call put_device() when device_register() fails.

> Signed-off-by: Rahul Ruikar<rahul.ruikar@gmail.com>
> ---
>   drivers/usb/gadget/langwell_udc.c |   18 ++++++++++++++----
>   drivers/usb/gadget/langwell_udc.h |    4 +++-
>   2 files changed, 17 insertions(+), 5 deletions(-)

> diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
> index c2d2a20..2b5ae16 100644
> --- a/drivers/usb/gadget/langwell_udc.c
> +++ b/drivers/usb/gadget/langwell_udc.c
> @@ -2952,8 +2952,13 @@ static void langwell_udc_remove(struct pci_dev *pdev)
>   	INFO(dev, "unbind\n");
>   	DBG(dev, "<--- %s()\n", __func__);
>
> -	device_unregister(&dev->gadget.dev);
> -	device_remove_file(&pdev->dev,&dev_attr_langwell_udc);
> +	if (dev->dev_reg_status == 2)
> +		device_unregister(&dev->gadget.dev);
> +	else if (dev->dev_reg_status == 1)
> +		put_device(&dev->gadget.dev);
> +
> +	if (dev->dev_create_file)
> +		device_remove_file(&pdev->dev,&dev_attr_langwell_udc);
>
>   #ifndef	OTG_TRANSCEIVER
>   	pci_set_drvdata(pdev, NULL);
> @@ -3190,12 +3195,17 @@ static int langwell_udc_probe(struct pci_dev *pdev,
>   	the_controller = dev;
>
>   	retval = device_register(&dev->gadget.dev);
> -	if (retval)
> +	if (retval) {
> +		dev_reg_status = 1;

    Did you mean 'dev->dev_reg_status'?

>   		goto error;
> +	}
> +	dev_reg_status = 2;

    Same question.

>
>   	retval = device_create_file(&pdev->dev,&dev_attr_langwell_udc);
> -	if (retval)
> +	if (retval) {
> +		dev_create_file = 1;

    Did you mean 'dev->dev_create_file'?

WBR, Sergei

  reply	other threads:[~2010-10-04 10:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-03 13:49 [PATCH] usb: gadget: langwell_udc: Fix error path Rahul Ruikar
2010-10-04 10:44 ` Sergei Shtylyov [this message]
2010-10-04 10:52   ` Rahul Ruikar
  -- strict thread matches above, loose matches on Subject: below --
2010-10-05 18:20 Rahul Ruikar
2010-10-05 19:17 ` Sergei Shtylyov
2010-10-06  2:34   ` Rahul Ruikar
2010-10-06 20:21     ` Greg KH
2010-10-07  3:55       ` Rahul Ruikar
2010-10-07  3:52 Rahul Ruikar
2010-10-07  3:54 ` Rahul Ruikar
2010-10-07 17:51 ` Greg KH
2010-10-07 18:19   ` Rahul Ruikar
2010-10-07 20:48     ` Greg KH

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=4CA9B004.3020103@ru.mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=gregkh@suse.de \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --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