jerpelea opened a new pull request, #19763:
URL: https://github.com/apache/nuttx/pull/19763

   ## Summary
   
   The registry is a singly linked list of static structures, so registering 
one of them a second time does not add a second entry: it points that entry's 
own link at itself, and the list stops having an end.
   
   Nothing notices while every device that turns up matches something near the 
head, because the search returns before it reaches the loop.  The first device 
that matches nothing at all, meaning anything without a class driver built in, 
walks the list to look for it and never comes back, holding the registry lock.  
On a multiprocessor the rest of the system follows it down: every other 
processor that touches the registry spins, and on the one measured here that 
included the console, so a board with a USB keyboard and no keyboard driver 
came up and then answered nothing.
   
   Registering twice is easy to do by accident.  drivers_initialize() calls 
usbhost_drivers_initialize(), which registers every class the configuration 
selected, and board code that also registers one, which many boards do, gets a 
second call for free.
   
   So look before linking, and treat a repeat registration as the no-op the 
caller expected it to be.
   
   Assisted-by: Claude:claude-opus-5
   
   ## Impact
   
   RELEASE
   
   ## Testing
   
   CI


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to