From: Alex Elder Date: Mon, 20 Oct 2014 15:27:55 +0000 (-0500) Subject: greybus: properly drop device reference X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1991 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=599dc6aa8ed91addf38814de22bdb5bb813a95aa;p=karo-tx-linux.git greybus: properly drop device reference Drop the USB device reference taken at the top of ap_probe() in the event greybus_create_hd() fails. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/es1-ap-usb.c b/drivers/staging/greybus/es1-ap-usb.c index 21fe4fdd4103..21db78fb863f 100644 --- a/drivers/staging/greybus/es1-ap-usb.c +++ b/drivers/staging/greybus/es1-ap-usb.c @@ -386,8 +386,10 @@ static int ap_probe(struct usb_interface *interface, udev = usb_get_dev(interface_to_usbdev(interface)); hd = greybus_create_hd(&es1_driver, &udev->dev); - if (!hd) + if (!hd) { + usb_put_dev(udev); return -ENOMEM; + } es1 = hd_to_es1(hd); es1->hd = hd;