Skip to content

Commit

Permalink
USB-IP: Deletion of unnecessary checks before the function call "usb_…
Browse files Browse the repository at this point in the history
…put_dev"

The usb_put_dev() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Valentina Manea <valentina.manea.m@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Markus Elfring authored and Greg Kroah-Hartman committed Nov 25, 2014
1 parent 0bfed50 commit 03f3df8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/usb/usbip/vhci_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
dev_info(dev, "SetAddress Request (%d) to port %d\n",
ctrlreq->wValue, vdev->rhport);

if (vdev->udev)
usb_put_dev(vdev->udev);
usb_put_dev(vdev->udev);
vdev->udev = usb_get_dev(urb->dev);

spin_lock(&vdev->ud.lock);
Expand All @@ -539,8 +538,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
usbip_dbg_vhci_hc(
"Not yet?:Get_Descriptor to device 0 (get max pipe size)\n");

if (vdev->udev)
usb_put_dev(vdev->udev);
usb_put_dev(vdev->udev);
vdev->udev = usb_get_dev(urb->dev);
goto out;

Expand Down Expand Up @@ -831,8 +829,7 @@ static void vhci_device_reset(struct usbip_device *ud)
vdev->speed = 0;
vdev->devid = 0;

if (vdev->udev)
usb_put_dev(vdev->udev);
usb_put_dev(vdev->udev);
vdev->udev = NULL;

if (ud->tcp_socket) {
Expand Down

0 comments on commit 03f3df8

Please sign in to comment.