public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: gadget: use explicit 0 for success in __dwc3_gadget_kick_transfer()
@ 2026-03-06  9:06 Zeeshan Ahmad
  2026-03-06 23:06 ` Thinh Nguyen
  0 siblings, 1 reply; 2+ messages in thread
From: Zeeshan Ahmad @ 2026-03-06  9:06 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman
  Cc: Dan Carpenter, linux-usb, smatch, kernel-janitors, linux-kernel,
	Zeeshan Ahmad

Smatch warns that __dwc3_gadget_kick_transfer() might be missing an
error code when returning 'ret' at line 1691.

While 'ret' is guaranteed to be 0 at this point, returning an explicit 0
improves readability by removing a level of indirection and clarifies
the intent that this is a successful "no-op" path. This change also
silences the Smatch warning.

Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Zeeshan Ahmad <zeeshanahmad022019@gmail.com>
---
Link: https://lore.kernel.org/linux-usb/CAPBWGpEi77+sksNLazw=dtyA3d6fBn-r10917k1rEzwzT3M=gA@mail.gmail.com/T/#t

 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 0a688904ce8c..3d4ca68e584c 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1688,7 +1688,7 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
 	 * transfer, there's no need to update the transfer.
 	 */
 	if (!ret && !starting)
-		return ret;
+		return 0;
 
 	req = next_request(&dep->started_list);
 	if (!req) {
-- 
2.43.0


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

* Re: [PATCH] usb: dwc3: gadget: use explicit 0 for success in __dwc3_gadget_kick_transfer()
  2026-03-06  9:06 [PATCH] usb: dwc3: gadget: use explicit 0 for success in __dwc3_gadget_kick_transfer() Zeeshan Ahmad
@ 2026-03-06 23:06 ` Thinh Nguyen
  0 siblings, 0 replies; 2+ messages in thread
From: Thinh Nguyen @ 2026-03-06 23:06 UTC (permalink / raw)
  To: Zeeshan Ahmad
  Cc: Thinh Nguyen, Greg Kroah-Hartman, Dan Carpenter,
	linux-usb@vger.kernel.org, smatch@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org

On Fri, Mar 06, 2026, Zeeshan Ahmad wrote:
> Smatch warns that __dwc3_gadget_kick_transfer() might be missing an
> error code when returning 'ret' at line 1691.
> 
> While 'ret' is guaranteed to be 0 at this point, returning an explicit 0
> improves readability by removing a level of indirection and clarifies
> the intent that this is a successful "no-op" path. This change also
> silences the Smatch warning.
> 
> Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Zeeshan Ahmad <zeeshanahmad022019@gmail.com>
> ---
> Link: https://urldefense.com/v3/__https://lore.kernel.org/linux-usb/CAPBWGpEi77*sksNLazw=dtyA3d6fBn-r10917k1rEzwzT3M=gA@mail.gmail.com/T/*t__;KyM!!A4F2R9G_pg!asXquh9-CUOJtLya2aWPEQl_uWyGLphqno6rG7xSh_10j6V-E5G492NcFEiNFEQI1E0Ek4O95dio0UeTqaXX1AAE8COKCO0$ 
> 
>  drivers/usb/dwc3/gadget.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 0a688904ce8c..3d4ca68e584c 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1688,7 +1688,7 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep)
>  	 * transfer, there's no need to update the transfer.
>  	 */
>  	if (!ret && !starting)
> -		return ret;
> +		return 0;
>  
>  	req = next_request(&dep->started_list);
>  	if (!req) {
> -- 
> 2.43.0
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

BR,
Thinh

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06  9:06 [PATCH] usb: dwc3: gadget: use explicit 0 for success in __dwc3_gadget_kick_transfer() Zeeshan Ahmad
2026-03-06 23:06 ` Thinh Nguyen

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