]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: properly drop device reference
authorAlex Elder <elder@linaro.org>
Mon, 20 Oct 2014 15:27:55 +0000 (10:27 -0500)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 20 Oct 2014 22:25:54 +0000 (06:25 +0800)
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>
drivers/staging/greybus/es1-ap-usb.c

index 21fe4fdd4103e2e066b1467282f227b9d9a58e57..21db78fb863f07239e7db9e2495ddcc76994f4d5 100644 (file)
@@ -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;