public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* Smatch: False positive in __dwc3_gadget_kick_transfer()
@ 2026-03-04  9:04 Zeeshan Ahmad
  2026-03-04 14:08 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Zeeshan Ahmad @ 2026-03-04  9:04 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: smatch, linux-usb, Zeeshan Ahmad

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;

In this context, ret = 0 is a valid success state. As noted in the 
comment at line 1676, it is normal to have no new TRBs prepared. 
The return at line 1691 signifies that no update to the transfer 
is required, which is a successful "no-op" rather than a failure.

It seems Smatch is flagging this because it expects a non-zero 
error code when the primary logic of a function is bypassed by 
a conditional check.

Best regards,
Zeeshan Ahmad

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-06  6:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04  9:04 Smatch: False positive in __dwc3_gadget_kick_transfer() Zeeshan Ahmad
2026-03-04 14:08 ` Dan Carpenter
2026-03-06  6:35   ` Zeeshan Ahmad

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox