From: Markus Elfring Date: Fri, 21 Nov 2014 15:33:18 +0000 (+0100) Subject: USB-IP: Deletion of unnecessary checks before the function call "usb_put_dev" X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=03f3df817dd3bf988c6d56e10e99b5b4553f5044;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git USB-IP: Deletion of unnecessary checks before the function call "usb_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 Acked-by: Valentina Manea Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index c02374b6049c..cc1b03eccf4a 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c @@ -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); @@ -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; @@ -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) {