mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
[media] cx231xx: fix usbdev leak on failure paths in cx231xx_usb_probe()
Commit b7085c0864
("cx231xx: convert from pr_foo to dev_foo")
moves usb_get_dev(interface_to_usbdev(interface)) to the beginning
of cx231xx_usb_probe() to use udev->dev in dev_err(),
but it does not make sure usbdev is put on all failure paths.
Later dev_err(udev->dev) was replaced by dev_err(d).
So the patch moves usb_get_dev() below (before the first use)
and fixes another failure path.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
e99f0115e5
commit
5eeb301482
1 changed files with 4 additions and 3 deletions
|
@ -1403,7 +1403,6 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
|||
struct usb_interface_assoc_descriptor *assoc_desc;
|
||||
|
||||
ifnum = interface->altsetting[0].desc.bInterfaceNumber;
|
||||
udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
|
||||
/*
|
||||
* Interface number 0 - IR interface (handled by mceusb driver)
|
||||
|
@ -1424,11 +1423,13 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
|
|||
}
|
||||
} while (test_and_set_bit(nr, &cx231xx_devused));
|
||||
|
||||
udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
|
||||
/* allocate memory for our device state and initialize it */
|
||||
dev = devm_kzalloc(&udev->dev, sizeof(*dev), GFP_KERNEL);
|
||||
if (dev == NULL) {
|
||||
clear_bit(nr, &cx231xx_devused);
|
||||
return -ENOMEM;
|
||||
retval = -ENOMEM;
|
||||
goto err_if;
|
||||
}
|
||||
|
||||
snprintf(dev->name, 29, "cx231xx #%d", nr);
|
||||
|
|
Loading…
Reference in a new issue