From 8a3b3ba07e499ef887f87c7245564e5e8535bed3 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 4 Jul 2014 08:17:14 -0600 Subject: AMA5 OHCI: Pointers to allocated port values were not being nullified after being deallocated. This caused some assertions when debug was enabled --- nuttx/arch/arm/src/sama5/sam_ohci.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nuttx/arch/arm/src/sama5/sam_ohci.c b/nuttx/arch/arm/src/sama5/sam_ohci.c index e05806e21..74eba1df4 100644 --- a/nuttx/arch/arm/src/sama5/sam_ohci.c +++ b/nuttx/arch/arm/src/sama5/sam_ohci.c @@ -1394,12 +1394,12 @@ static int sam_ep0enqueue(struct sam_rhport_s *rhport) tdtail = sam_tdalloc(); if (!tdtail) { - sam_edfree(rhport->ep0.ed); + sam_edfree(edctrl); irqrestore(flags); return -ENOMEM; } - rhport->ep0.ed = edctrl; + rhport->ep0.ed = edctrl; rhport->ep0.tail = tdtail; /* ControlListEnable. This bit is cleared to disable the processing of the @@ -1466,7 +1466,7 @@ static int sam_ep0enqueue(struct sam_rhport_s *rhport) * Name: sam_ep0dequeue * * Description: - * Remove the ED for EP0 from the control ED list and posssibly disable control + * Remove the ED for EP0 from the control ED list and possibly disable control * list processing. * * Input Parameters: @@ -1548,6 +1548,7 @@ static void sam_ep0dequeue(struct sam_rhport_s *rhport) sam_putreg(regval, SAM_USBHOST_CTRL); } } + irqrestore(flags); /* Release any TDs that may still be attached to the ED. */ @@ -1567,6 +1568,9 @@ static void sam_ep0dequeue(struct sam_rhport_s *rhport) sam_tdfree(tdtail); sam_edfree(edctrl); + + rhport->ep0.ed = NULL; + rhport->ep0.tail = NULL; } /******************************************************************************* -- cgit v1.2.3