Skip to contentSkip to conversation

usb: dwc3: gadget: use explicit 0 for success in __dwc3_gadget_kick_transfer()

PATCH In review Zeeshan Ahmad 2 participants 2 messages Mar 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc3: gadget: use explicit 0 for success in __dwc3_gadget_kick_transfer()

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.

---

 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +1 -1
index 0a688904ce8c..3d4ca68e584c 100644
@@ -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) {
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 32 lines · 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.

---

 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +1 -1
index 0a688904ce8c..3d4ca68e584c 100644
@@ -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) {
Signature · 1 line
2.43.0

BR,
Thinh