From 599dc6aa8ed91addf38814de22bdb5bb813a95aa Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Mon, 20 Oct 2014 10:27:55 -0500 Subject: [PATCH] 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 --- drivers/staging/greybus/es1-ap-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.39.5