summaryrefslogtreecommitdiffstats
path: root/drivers/usb/usbip
diff options
context:
space:
mode:
authorSuwan Kim <suwan.kim027@gmail.com>2019-03-05 16:11:10 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-19 15:00:34 +0100
commitfc2f113e5c0ee9a297c62700d8b71809f5785b33 (patch)
treed814c97387fb35df2f34e0709acb714188466f07 /drivers/usb/usbip
parentUSB: usb.h: tweak struct urb to remove wasted space (diff)
downloadlinux-fc2f113e5c0ee9a297c62700d8b71809f5785b33.tar.xz
linux-fc2f113e5c0ee9a297c62700d8b71809f5785b33.zip
usbip: Remove unnecessary null check
"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>
Diffstat (limited to 'drivers/usb/usbip')
-rw-r--r--drivers/usb/usbip/vhci_hcd.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index f46ee1fefe02..667d9c0ec905 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -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);