[PATCH RESEND] usb: dwc3: Remove redundant test

Tom Rini trini at konsulko.com
Mon Sep 29 16:10:17 CEST 2025


On Mon, Sep 29, 2025 at 03:27:19PM +0200, Marek Vasut wrote:
> On 9/29/25 11:11 AM, Andrew Goodbody wrote:
> > In dwc3_ep0_complete_data there is a test for 'r' being null and the
> > code will return at that point if so. After that point 'r' is guaranteed
> > to not be null and testing for that is redundant. Remove the test for
> > 'r' being non-null.
> 
> If you really want to make this obvious, use git send-email -U20 or some
> such, this will add more context into the diff and include the relevant
> part:
> 
>  793         r = next_request(&ep0->request_list);
>  794         if (!r)
>  795                 return;
>              ^^^^^^^^^^^^^^^
>  796
>  797         dwc3_flush_cache((uintptr_t)trb, sizeof(*trb));
>  798
>  799         status = DWC3_TRB_SIZE_TRBSTS(trb->size);
>  800         if (status == DWC3_TRBSTS_SETUP_PENDING) {
>  801                 dev_dbg(dwc->dev, "Setup Pending received");
>  802
>  803                 if (r)
>  804                         dwc3_gadget_giveback(ep0, r, -ECONNRESET);
> 
> Reviewed-by: Marek Vasut <marek.vasut at mailbox.org>

FWIW, to me updating the amount of context in a sent patch is a style
choice. Yes, just a few more lines in this case would make it clear but
in lots of other cases to review you need to look at the whole function
anyhow (and sometimes catch other issues / places to refactor things for
clarity, ie the pfuze100 patch thread).

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250929/e50cea94/attachment.sig>


More information about the U-Boot mailing list