Re: Smatch: False positive in __dwc3_gadget_kick_transfer()
Zeeshan Ahmad <[email protected]> Fri, 6 Mar 2026 11:35:08 +0500
| Newsgroups | org.kernel.vger.smatch,org.kernel.vger.linux-usb |
|---|---|
| Message-ID | <CAPBWGpEi77+sksNLazw=dtyA3d6fBn-r10917k1rEzwzT3M=gA@mail.gmail.com> |
Hi Dan, Thank you for the explanation and the manager's joke. On Wed, Mar 4, 2026 at 7:09=E2=80=AFPM Dan Carpenter <dan.carpenter@linaro.= org> wrote: > 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 agree. Since the !ret condition ensures that ret is 0 at that point, using an explicit return makes the successful "no-op" path immediately clear to the reader and removes the logical overhead of tracking the variable. > 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 I will ensure my zeros are extra round in the patch. I'll prepare a clean-up patch for the USB tree to implement this and silence the warning. Best regards, Zeeshan