From 9296eca193c90d8657a8eab1c44893c30f5d80b1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 5 May 2015 14:59:03 -0600 Subject: [PATCH] USB Host function address calculation needs to reset the 'next' address when an address is released --- drivers/usbhost/usbhost_devaddr.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usbhost/usbhost_devaddr.c b/drivers/usbhost/usbhost_devaddr.c index a36f7a4f1a..578e2ea684 100644 --- a/drivers/usbhost/usbhost_devaddr.c +++ b/drivers/usbhost/usbhost_devaddr.c @@ -164,6 +164,13 @@ static void usbhost_devaddr_free(FAR struct usbhost_devaddr_s *devgen, DEBUGASSERT((devgen->alloctab[index] |= (1 << bitno)) != 0); devgen->alloctab[index] &= ~(1 << bitno); + + /* Reset the next pointer if the one just released has a lower value */ + + if (devaddr < devgen->next) + { + devgen->next = devaddr; + } } /*******************************************************************************