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 <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
Alex Elder 2014-10-20 10:27:55 -05:00 committed by Greg Kroah-Hartman
parent 6813e35a0e
commit 599dc6aa8e
1 changed files with 3 additions and 1 deletions

View File

@ -386,8 +386,10 @@ static int ap_probe(struct usb_interface *interface,
udev = usb_get_dev(interface_to_usbdev(interface)); udev = usb_get_dev(interface_to_usbdev(interface));
hd = greybus_create_hd(&es1_driver, &udev->dev); hd = greybus_create_hd(&es1_driver, &udev->dev);
if (!hd) if (!hd) {
usb_put_dev(udev);
return -ENOMEM; return -ENOMEM;
}
es1 = hd_to_es1(hd); es1 = hd_to_es1(hd);
es1->hd = hd; es1->hd = hd;