-
Notifications
You must be signed in to change notification settings - Fork 8k
drivers: usb: stm32: HAL return value handling #97283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file are no longer accepted AFAIK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most (all?) of these functions cannot fail so I don't see any value in adding error checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then why do they have a return value. It's weird regarding Zephyr guideline "If a function returns error information, then that error information shall be tested".
That said I'm fine dropping these changes. After seeing a few mixup of HAL return values and standard errno value, I wanted to clean then hence this change series. I expect not functional change with these patches but better HAL integration example for future contributions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an assertion on return value would be enough.
Alternatively I think at least an inline comment should state that it's safe to discard the return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then why do they have a return value. It's weird regarding Zephyr guideline "If a function returns error information, then that error information shall be tested".
Something something HAL guidelines. Alas...
Maybe an assertion on return value would be enough. Alternatively I think at least an inline comment should state that it's safe to discard the return value.
__ASSERT_NO_MSG(hal_ret == HAL_OK);
checks would be fine by me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, i'll change to assertion.
de57d85
to
46eea7f
Compare
Add missing test of some HAL functions return value;. Signed-off-by: Etienne Carriere <[email protected]>
46eea7f
to
5ca3380
Compare
|
Add missing test of some HAL functions return value.