[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150623105738.GD1296@kuha.fi.intel.com>
Date: Tue, 23 Jun 2015 13:57:38 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: ChengYi He <chengyihetaipei@...il.com>
Cc: Felipe Balbi <balbi@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: ulpi: call put_device if device_register fails
On Fri, Jun 19, 2015 at 01:12:36AM +0800, ChengYi He wrote:
> put_device is required to release the last reference to the device.
>
> Signed-off-by: ChengYi He <chengyihetaipei@...il.com>
> ---
> drivers/usb/common/ulpi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
> index 0e6f968..bd25bdb 100644
> --- a/drivers/usb/common/ulpi.c
> +++ b/drivers/usb/common/ulpi.c
> @@ -184,8 +184,10 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)
> request_module("ulpi:v%04xp%04x", ulpi->id.vendor, ulpi->id.product);
>
> ret = device_register(&ulpi->dev);
> - if (ret)
> + if (ret) {
> + put_device(&ulpi->dev);
If device_register returns failure, put_device has already been
called. Check device_add in drivers/base/core.c.
Thanks,
--
heikki
--
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