[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=W=8Gi9NDRy1MqFC6nuoQ5nymSsZU0Z2zE_cag@mail.gmail.com>
Date: Sat, 2 Oct 2010 15:54:38 +0800
From: Ming Lei <tom.leiming@...il.com>
To: Rahul Ruikar <rahul.ruikar@...il.com>
Cc: Felipe Balbi <balbi@...com>, Greg Kroah-Hartman <gregkh@...e.de>,
Sergei Shtylyov <sshtylyov@...mvista.com>,
Mike Frysinger <vapier@...too.org>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: musb: musb_gadget: Fix error path
2010/10/2 Rahul Ruikar <rahul.ruikar@...il.com>:
> In function musb_gadget_setup()
> call put_device() when device_register() fails.
>
> Signed-off-by: Rahul Ruikar <rahul.ruikar@...il.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@...il.com>
--
Lei Ming
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists