Skip to contentSkip to conversation

usb: dwc3: gadget: Remove redundant assignment to pointer trb

PATCH In review Colin Ian King 2 participants 2 messages Feb 7, 2024 – Feb 8, 2024

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

PATCH 1/1 usb: dwc3: gadget: Remove redundant assignment to pointer trb

The pointer trb is being assigned a value that is not being read afterwards, it is being re-assigned later inside a for_each_sg loop. The assignment is redundant and can be removed.

Cleans up clang scan warning:
drivers/usb/dwc3/gadget.c:3432:19: warning: Value stored to 'trb' during its initialization is never read [deadcode.DeadStores]

---
 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +1 -1
index 564976b3e2b9..6e47259f2c4f 100644
@@ -3429,7 +3429,7 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep,
 		struct dwc3_request *req, const struct dwc3_event_depevt *event,
 		int status)
 {
-	struct dwc3_trb *trb = &dep->trb_pool[dep->trb_dequeue];
+	struct dwc3_trb *trb;
 	struct scatterlist *sg = req->sg;
 	struct scatterlist *s;
 	unsigned int num_queued = req->num_queued_sgs;
Signature · 1 line
2.39.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 29 lines · Colin Ian King

The pointer trb is being assigned a value that is not being read afterwards, it is being re-assigned later inside a for_each_sg loop. The assignment is redundant and can be removed.

Cleans up clang scan warning:
drivers/usb/dwc3/gadget.c:3432:19: warning: Value stored to 'trb' during its initialization is never read [deadcode.DeadStores]

---
 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +1 -1
index 564976b3e2b9..6e47259f2c4f 100644
@@ -3429,7 +3429,7 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep,
 		struct dwc3_request *req, const struct dwc3_event_depevt *event,
 		int status)
 {
-	struct dwc3_trb *trb = &dep->trb_pool[dep->trb_dequeue];
+	struct dwc3_trb *trb;
 	struct scatterlist *sg = req->sg;
 	struct scatterlist *s;
 	unsigned int num_queued = req->num_queued_sgs;
Signature · 1 line
2.39.2

Thinh