-
Notifications
You must be signed in to change notification settings - Fork 2k
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
drivers: Break conditions for waiting loops #3064
Comments
I don't know if such approach would ease things. |
The driver should return with an error code then. |
I partly agree with @BytesGalore that there might be a risk of undefined states. But in general I still think it's more comfortable to return somehow instead of running in an endless loop. Just returning and continuing the program should be avoided. The possibilities I see is either (i) return a defined error code, explicitly document it and check for this code or (ii) running into hard fault. With (i) there might be still a risk to run programs in an undefined state. (ii) feels a bit overstated to me. |
I think returning an error code is the only sensible thing to do. If the application is critically dependent on a subsystem which gives an error code, then the application should be able to decide if/when to perform a system reset (which would be the end result of the hardfault alternative). I don't think we should force the system into a hardfault or similar because of e.g. a communication problem on an SPI bus. |
So the consensus is to add a timeout or similar to all of these occurrences and return with an error then. Right? |
I guess so. |
This is also related to #3366 |
|
So we still need some (/one) volunteer(/s) to take over that routine work as well as someone to test it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
As discussed in #2911 (comment): In many places in hardware dependent code, one has to wait for an undetermined time until e.g. a register is set. Typically this is done in a while loop, which, however, could cause an endless loop in case of a hardware failure. Ergo, I would strongly vote to introduce a simple counter or similar that breaks the loop if the expected state has not been reached after N tries.
The text was updated successfully, but these errors were encountered: