Commit 50c88544 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Mauro Carvalho Chehab

[media] go7007-loader: fix usb_dev leak

There is usb_get_dev() in go7007_loader_probe(),
but there is no usb_put_dev() anywhere.

Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 38121b6e
...@@ -59,7 +59,7 @@ static int go7007_loader_probe(struct usb_interface *interface, ...@@ -59,7 +59,7 @@ static int go7007_loader_probe(struct usb_interface *interface,
if (usbdev->descriptor.bNumConfigurations != 1) { if (usbdev->descriptor.bNumConfigurations != 1) {
dev_err(&interface->dev, "can't handle multiple config\n"); dev_err(&interface->dev, "can't handle multiple config\n");
return -ENODEV; goto failed2;
} }
vendor = le16_to_cpu(usbdev->descriptor.idVendor); vendor = le16_to_cpu(usbdev->descriptor.idVendor);
...@@ -108,6 +108,7 @@ static int go7007_loader_probe(struct usb_interface *interface, ...@@ -108,6 +108,7 @@ static int go7007_loader_probe(struct usb_interface *interface,
return 0; return 0;
failed2: failed2:
usb_put_dev(usbdev);
dev_err(&interface->dev, "probe failed\n"); dev_err(&interface->dev, "probe failed\n");
return -ENODEV; return -ENODEV;
} }
...@@ -115,6 +116,7 @@ static int go7007_loader_probe(struct usb_interface *interface, ...@@ -115,6 +116,7 @@ static int go7007_loader_probe(struct usb_interface *interface,
static void go7007_loader_disconnect(struct usb_interface *interface) static void go7007_loader_disconnect(struct usb_interface *interface)
{ {
dev_info(&interface->dev, "disconnect\n"); dev_info(&interface->dev, "disconnect\n");
usb_put_dev(interface_to_usbdev(interface));
usb_set_intfdata(interface, NULL); usb_set_intfdata(interface, NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment