change(usbd): Changed return value to true for weak dcd_deinit() (quick fix)#3370
change(usbd): Changed return value to true for weak dcd_deinit() (quick fix)#3370roma-jam wants to merge 1 commit intohathach:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an assertion failure in ports where dcd_deinit() is not yet implemented by changing the weak function's default return value from false to true. This aligns with the pattern used by other weak DCD cache functions and allows the TU_VERIFY(dcd_deinit(rhport)) assertion to pass when the function hasn't been overridden.
Key changes:
- Modified the weak
dcd_deinit()function to returntrueinstead offalseby default
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I think we can take the chance to add |
|
Hi @HiFiPhile,
Sure, that is my next step. This PR is about another thing: the |
|
My concern is maybe other port require additional tweak to proper deinit, returning true will hide the issue. I prefer to make dcd_deinit(uint8_t rhport) {
(void) rhport;
// to be filled later
return true;
}@hathach What do you think ? We also need to add |
|
Addressed in #3378 |
Description
During the recent update (#3326)
dcd_deinit(rhport);->TU_VERIFY(dcd_deinit(rhport));the assertion fails for the ports, where
dcd_deinit()isn't implemented yet.Changes
This PR introduces a quick fix by changing the default return value from
falsetotruein the WEAK function, allowing the assert to pass.The same way, as we have it for:
Context
The real implementation may vary, but for dcd_dwc2 (for example), this might still be not implemented, as we re-configure the controller fully during the following
dcd_init().