mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: musb: musb_gadget: Fix error path
@ 2010-10-02  6:35 Rahul Ruikar
  2010-10-02  7:54 ` Ming Lei
  2010-11-05 12:19 ` Felipe Balbi
  0 siblings, 2 replies; 3+ messages in thread
From: Rahul Ruikar @ 2010-10-02  6:35 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Ming Lei, Sergei Shtylyov,
	Mike Frysinger
  Cc: linux-usb, linux-kernel, Rahul Ruikar

In function musb_gadget_setup()
call put_device() when device_register() fails.

Signed-off-by: Rahul Ruikar <rahul.ruikar@gmail.com>
---
 drivers/usb/musb/musb_gadget.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index d065e23..9fdd852 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1676,8 +1676,10 @@ int __init musb_gadget_setup(struct musb *musb)
 	musb_platform_try_idle(musb, 0);
 
 	status = device_register(&musb->g.dev);
-	if (status != 0)
+	if (status != 0) {
+		put_device(&musb->g.dev);
 		the_gadget = NULL;
+	}
 	return status;
 }
 
-- 
1.7.2.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: musb: musb_gadget: Fix error path
  2010-10-02  6:35 [PATCH] usb: musb: musb_gadget: Fix error path Rahul Ruikar
@ 2010-10-02  7:54 ` Ming Lei
  2010-11-05 12:19 ` Felipe Balbi
  1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2010-10-02  7:54 UTC (permalink / raw)
  To: Rahul Ruikar
  Cc: Felipe Balbi, Greg Kroah-Hartman, Sergei Shtylyov,
	Mike Frysinger, linux-usb, linux-kernel

2010/10/2 Rahul Ruikar <rahul.ruikar@gmail.com>:
> In function musb_gadget_setup()
> call put_device() when device_register() fails.
>
> Signed-off-by: Rahul Ruikar <rahul.ruikar@gmail.com>
> ---
>  drivers/usb/musb/musb_gadget.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> index d065e23..9fdd852 100644
> --- a/drivers/usb/musb/musb_gadget.c
> +++ b/drivers/usb/musb/musb_gadget.c
> @@ -1676,8 +1676,10 @@ int __init musb_gadget_setup(struct musb *musb)
>        musb_platform_try_idle(musb, 0);
>
>        status = device_register(&musb->g.dev);
> -       if (status != 0)
> +       if (status != 0) {
> +               put_device(&musb->g.dev);

This doe make sense, otherwise device_private may be leaked.

>                the_gadget = NULL;
> +       }
>        return status;
>  }
>
> --
> 1.7.2.3
>
>

Acked-by: Ming Lei <tom.leiming@gmail.com>

-- 
Lei Ming

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: musb: musb_gadget: Fix error path
  2010-10-02  6:35 [PATCH] usb: musb: musb_gadget: Fix error path Rahul Ruikar
  2010-10-02  7:54 ` Ming Lei
@ 2010-11-05 12:19 ` Felipe Balbi
  1 sibling, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2010-11-05 12:19 UTC (permalink / raw)
  To: Rahul Ruikar
  Cc: Balbi, Felipe, Greg Kroah-Hartman, Ming Lei, Sergei Shtylyov,
	Mike Frysinger, linux-usb, linux-kernel

On Sat, Oct 02, 2010 at 01:35:48AM -0500, Rahul Ruikar wrote:
>In function musb_gadget_setup()
>call put_device() when device_register() fails.
>
>Signed-off-by: Rahul Ruikar <rahul.ruikar@gmail.com>

applied, thanks

-- 
balbi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-05 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-02  6:35 [PATCH] usb: musb: musb_gadget: Fix error path Rahul Ruikar
2010-10-02  7:54 ` Ming Lei
2010-11-05 12:19 ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®