summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-07-04 08:17:14 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-07-04 08:17:14 -0600
commit8a3b3ba07e499ef887f87c7245564e5e8535bed3 (patch)
tree0a6b2c2fd40b28092bcba02776a396ae7e003d68
parent5e13e7f9e6c92200ed5e52e30c18efb9a7d5f131 (diff)
downloadnuttx-8a3b3ba07e499ef887f87c7245564e5e8535bed3.tar.gz
nuttx-8a3b3ba07e499ef887f87c7245564e5e8535bed3.tar.bz2
nuttx-8a3b3ba07e499ef887f87c7245564e5e8535bed3.zip
AMA5 OHCI: Pointers to allocated port values were not being nullified after being deallocated. This caused some assertions when debug was enabled
-rw-r--r--nuttx/arch/arm/src/sama5/sam_ohci.c10
1 files 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;
}
/*******************************************************************************