Skip to main content
Visitor II
August 12, 2021
Question

Bug in USBD_core when resetting?

  • August 12, 2021
  • 1 reply
  • 713 views

I was chasing down a problem and came across this code in the USBD_LL_RESET function inside of USBD_core.c:

if (pdev->pClassData != NULL)
{
 if (pdev->pClass->DeInit != NULL)
 {
 (void)pdev->pClass->DeInit(pdev, (uint8_t)pdev->dev_config);
 }
}

However, every other place that calls pClass->DeInit (there are 4 of them) has the following code:

if (pdev->pClass != NULL)
{
 (void)pdev->pClass->DeInit(pdev, (uint8_t)pdev->dev_config);
}

Shouldn't the first example match the following ones? If you're resetting the USB, wouldn't you always want to call the DeInit function, regardless of whether or not there is pClassData? You're clearing it everywhere else, why not there as well?

This code, or something very similar (most recent framework is slightly different than the old ones), exists in the L4 and H7 frameworks, so presumably the others as well.

    This topic has been closed for replies.

    1 reply

    Visitor II
    August 18, 2021

    Hello @JKaz.1​ ,

    The issue has been raised internally.

    Thank you for reporting this out.

    BeST Regards,

    Walid

    Visitor II
    August 18, 2021

    ST Internal Reference: 112054 (PS: This is an internal tracking number and is not accessible or usable by customers).