Merge "usb: dwc3: Avoid NULL pointer access"

This commit is contained in:
qctecmdr 2019-10-28 17:12:01 -07:00 • committed by Gerrit - the friendly Code Review server
commit 79600075fb

View file

@ -982,6 +982,9 @@ static struct dwc3_trb *dwc3_ep_prev_trb(struct dwc3_ep *dep, u8 index)
{
u8 tmp = index;
if (!dep->trb_pool)
return NULL;
if (!tmp)
tmp = DWC3_TRB_NUM - 1;
@ -1730,7 +1733,11 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
else
trb = &dwc->ep0_trb[dep->trb_enqueue];
transfer_in_flight = trb->ctrl & DWC3_TRB_CTRL_HWO;
if (trb)
transfer_in_flight = trb->ctrl & DWC3_TRB_CTRL_HWO;
else
transfer_in_flight = false;
started = !list_empty(&dep->started_list);
if (!protocol && ((dep->direction && transfer_in_flight) ||