public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Zeeshan Ahmad <zeeshanahmad022019@gmail.com>
Cc: smatch@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: Smatch: False positive in __dwc3_gadget_kick_transfer()
Date: Wed, 4 Mar 2026 17:08:58 +0300	[thread overview]
Message-ID: <aag8-unh5oLLajDh@stanley.mountain> (raw)
In-Reply-To: <20260304090408.36774-1-zeeshanahmad022019@gmail.com>

On Wed, Mar 04, 2026 at 02:04:08PM +0500, Zeeshan Ahmad wrote:
> Hi Dan,
> 
> I am performing a logic audit of the DWC3 driver and encountered a 
> consistent Smatch warning in drivers/usb/dwc3/gadget.c that appears 
> to be a false positive.
> 
> The warning:
> drivers/usb/dwc3/gadget.c:1691 __dwc3_gadget_kick_transfer() warn: missing error code? 'ret'
> 
> The code:
> 1680:         ret = dwc3_prepare_trbs(dep);
> 1681:         if (ret < 0)
> 1682:                 return ret;
> ...
> 1690:         if (!ret && !starting)
> 1691:                 return ret;

Just do "return 0;"  It's more readable, since it removes a level of
indirection and we don't have to think about what ret is.

I always recall a discuss between my managers:
Q: But if we do that then how will they know where the zero comes from?
A: We'll make our zeroes will *extra* round.  :P

regards,
dan carpenter


  reply	other threads:[~2026-03-04 14:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04  9:04 Smatch: False positive in __dwc3_gadget_kick_transfer() Zeeshan Ahmad
2026-03-04 14:08 ` Dan Carpenter [this message]
2026-03-06  6:35   ` Zeeshan Ahmad

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=aag8-unh5oLLajDh@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=smatch@vger.kernel.org \
    --cc=zeeshanahmad022019@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