Merge "usb: dwc3: Avoid NULL pointer access in dwc3_calc_trbs_left"

This commit is contained in:
qctecmdr 2019-10-28 13:03:02 -07:00 • committed by Gerrit - the friendly Code Review server
commit 6d73fbad77

View file

@ -1002,7 +1002,7 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep)
*/
if (dep->trb_enqueue == dep->trb_dequeue) {
tmp = dwc3_ep_prev_trb(dep, dep->trb_enqueue);
if (tmp->ctrl & DWC3_TRB_CTRL_HWO)
if (!tmp || tmp->ctrl & DWC3_TRB_CTRL_HWO)
return 0;
return DWC3_TRB_NUM - 1;