public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: cgel.zte@gmail.com
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	luo penghao <luo.penghao@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH linux] usb: xhci-ring: Add return if ret is less than 0
Date: Thu, 30 Dec 2021 08:02:00 +0100	[thread overview]
Message-ID: <Yc1ZaOsmoZHoWyxt@kroah.com> (raw)
In-Reply-To: <20211230064010.586496-1-luo.penghao@zte.com.cn>

On Thu, Dec 30, 2021 at 06:40:10AM +0000, cgel.zte@gmail.com wrote:
> From: luo penghao <luo.penghao@zte.com.cn>
> 
> For the robustness of the code, judgment and return should be added here

I do not understand this changelog text at all.  Please explain the
problem and why you are making this change much better.

> 
> The clang_analyzer complains as follows:
> 
> drivers/usb/host/xhci-ring.c:
> 
> Value stored to 'ret' is never read
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: luo penghao <luo.penghao@zte.com.cn>
> ---
>  drivers/usb/host/xhci-ring.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index d0b6806..c4eefe2 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -3721,6 +3721,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
>  		ret = prepare_transfer(xhci, xhci->devs[slot_id],
>  				       ep_index, urb->stream_id,
>  				       1, urb, 1, mem_flags);
> +		if (unlikely(ret < 0))
> +			return ret;
>  		urb_priv->td[1].last_trb = ring->enqueue;
>  		urb_priv->td[1].last_trb_seg = ring->enq_seg;
>  		field = TRB_TYPE(TRB_NORMAL) | ring->cycle_state | TRB_IOC;
> -- 
> 2.15.2
> 
> 

How did you test this change?

thanks,

greg k-h

  reply	other threads:[~2021-12-30  7:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-30  6:40 [PATCH linux] usb: xhci-ring: Add return if ret is less than 0 cgel.zte
2021-12-30  7:02 ` Greg Kroah-Hartman [this message]
2021-12-30 13:31   ` Mathias Nyman

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=Yc1ZaOsmoZHoWyxt@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=cgel.zte@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=luo.penghao@zte.com.cn \
    --cc=mathias.nyman@intel.com \
    --cc=zealci@zte.com.cn \
    /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