Skip to content

Commit

Permalink
usb: dwc2: Fix issues in dwc2_complete_non_isoc_xfer_ddma()
Browse files Browse the repository at this point in the history
Fixes a static analysis issue in dwc2_complete_non_isoc_xfer_ddma(). The
qtd was being passed to a function after being freed. It was not being
used in the function so this doesn't fix any bugs. But it fixes up the
warning and makes the code safer by setting qtd to NULL and not using it
at all.

Reported-by: Felipe Balbi <[email protected]>
Signed-off-by: John Youn <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
jysnps authored and felipebalbi committed Mar 4, 2016
1 parent 6c0c095 commit 1fc6598
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/usb/dwc2/hcd_ddma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1245,8 +1245,10 @@ static void dwc2_complete_non_isoc_xfer_ddma(struct dwc2_hsotg *hsotg,
for (i = 0; i < qtd_desc_count; i++) {
if (dwc2_process_non_isoc_desc(hsotg, chan, chnum, qtd,
desc_num, halt_status,
&xfer_done))
&xfer_done)) {
qtd = NULL;
goto stop_scan;
}

desc_num++;
}
Expand All @@ -1261,7 +1263,7 @@ static void dwc2_complete_non_isoc_xfer_ddma(struct dwc2_hsotg *hsotg,
if (halt_status == DWC2_HC_XFER_STALL)
qh->data_toggle = DWC2_HC_PID_DATA0;
else
dwc2_hcd_save_data_toggle(hsotg, chan, chnum, qtd);
dwc2_hcd_save_data_toggle(hsotg, chan, chnum, NULL);
}

if (halt_status == DWC2_HC_XFER_COMPLETE) {
Expand Down

0 comments on commit 1fc6598

Please sign in to comment.