[PATCH RESEND] usb: dwc3: Remove redundant test

Mattijs Korpershoek mkorpershoek at kernel.org
Tue Sep 30 09:47:24 CEST 2025


Hi Andrew,

Thank you for the patch.

On Mon, Sep 29, 2025 at 10:11, Andrew Goodbody <andrew.goodbody at linaro.org> 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.
>
> This issue was found by Smatch.
>
> Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>

Reviewed-by: Mattijs Korpershoek <mkorpershoek at kernel.org>

> ---
>  drivers/usb/dwc3/ep0.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
> index c656cbe25ce6fad9ca1ef07aba131d30018db19d..680756532f0db16f7e6598df19f71bf2ab410820 100644
> --- a/drivers/usb/dwc3/ep0.c
> +++ b/drivers/usb/dwc3/ep0.c
> @@ -799,10 +799,7 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
>  	status = DWC3_TRB_SIZE_TRBSTS(trb->size);
>  	if (status == DWC3_TRBSTS_SETUP_PENDING) {
>  		dev_dbg(dwc->dev, "Setup Pending received");
> -
> -		if (r)
> -			dwc3_gadget_giveback(ep0, r, -ECONNRESET);
> -
> +		dwc3_gadget_giveback(ep0, r, -ECONNRESET);
>  		return;
>  	}
>  
>
> ---
> base-commit: 44c4919e9dd6c162b237633ba689441eca9a149c
> change-id: 20250925-dwc3_ep0-47c99180480d
>
> Best regards,
> -- 
> Andrew Goodbody <andrew.goodbody at linaro.org>


More information about the U-Boot mailing list