lkml.org 
[lkml]   [2019]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] usbip: Remove unnecessary null check
From
Date
Hi Suwan,

On 3/5/19 8:11 AM, Suwan Kim wrote:
> "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>
> ---
> drivers/usb/usbip/vhci_hcd.c | 8 +-------
> 1 file changed, 1 insertion(+), 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 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> 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);
>

Thanks for the patch. Looks good to me.

Acked-by: Shuah Khan <shuah@kernel.org>

thanks,
-- Shuah

\
 
 \ /
  Last update: 2019-03-06 16:11    [W:0.044 / U:0.240 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site