linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shuah <shuah@kernel.org>
To: Suwan Kim <suwan.kim027@gmail.com>,
	valentina.manea.m@gmail.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usbip: Remove unnecessary null check
Date: Wed, 6 Mar 2019 08:11:00 -0700	[thread overview]
Message-ID: <d40255b3-5f87-c6a5-ebe2-c499dc858b76@kernel.org> (raw)
In-Reply-To: <20190305151110.4366-1-suwan.kim027@gmail.com>

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

      reply	other threads:[~2019-03-06 15:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 15:11 [PATCH] usbip: Remove unnecessary null check Suwan Kim
2019-03-06 15:11 ` shuah [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d40255b3-5f87-c6a5-ebe2-c499dc858b76@kernel.org \
    --to=shuah@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=suwan.kim027@gmail.com \
    --cc=valentina.manea.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).