usbip: Remove unnecessary null check
authorSuwan Kim <suwan.kim027@gmail.com>
Tue, 5 Mar 2019 15:11:10 +0000 (00:11 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Mar 2019 14:00:34 +0000 (15:00 +0100)
"vdev" points to vhci_hcd->vdev[] array and vhci_hcd->vdev[] array
is not a pointer array but a structure array and it is already used
in vhci_urb_enqueue() and then passed to vhci_tx_urb() as an argument.
vhci_tx_urb() is not called except vhci_urb_enqueue(). So, "vdev"
can not be null pointer. This null check statement is meaningless.

Signed-off-by: Suwan Kim <suwan.kim027@gmail.com>
Acked-by: Shuah Khan <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/vhci_hcd.c

index f46ee1f..667d9c0 100644 (file)
@@ -654,15 +654,9 @@ error:
 static void vhci_tx_urb(struct urb *urb, struct vhci_device *vdev)
 {
        struct vhci_priv *priv;
-       struct vhci_hcd *vhci_hcd;
+       struct vhci_hcd *vhci_hcd = vdev_to_vhci_hcd(vdev);
        unsigned long flags;
 
-       if (!vdev) {
-               pr_err("could not get virtual device");
-               return;
-       }
-       vhci_hcd = vdev_to_vhci_hcd(vdev);
-
        priv = kzalloc(sizeof(struct vhci_priv), GFP_ATOMIC);
        if (!priv) {
                usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC);