-
Notifications
You must be signed in to change notification settings - Fork 1.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
applications: nrf5340_audio: Add a deinitialise function #16296
Conversation
Test specificationCI/Jenkins/NRF
CI/Jenkins/integration
Detailed information of selected test modules Note: This message is automatically posted and updated by the CI |
You can find the documentation preview for this PR at this link. It will be updated about 10 minutes after the documentation build succeeds. Note: This comment is automatically posted by the Documentation Publishing GitHub Action. |
@@ -167,6 +167,22 @@ int data_fifo_empty(struct data_fifo *data_fifo) | |||
return 0; | |||
} | |||
|
|||
int data_fifo_deinit(struct data_fifo *data_fifo) | |||
{ | |||
__ASSERT_NO_MSG(data_fifo != NULL); |
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.
Recommend using ASSERT with message.
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.
On this, It is good to test like this, but if there is an issue in the release that would have exercised this assert but it has been optimised out, then the codes action would be undetermined and potentially difficult to debug. Would be more code but better in my option to explicitly test for NULL. Actually it shouldn't be more than a test zero and branch (with branch prediction this will be even better). An error is already returned and tested for, so the code could gracefully fail, rather than go off somewhere into memory!
include/data_fifo.h
Outdated
/** | ||
* @brief Deinitialise the data_fifo. | ||
* | ||
* @note The fifo is emptied first, so it is the users responsibility to release any data items it |
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.
What happens if the user does not release all the data items?
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.
What will happen to any buffers that are carried in the message?
We get a message and load it with a pointer to some data (on a slab for example). When all the messages are released what happens to this item and the slab it is on? It may be lost to the system!
4edc62e
to
2e8465c
Compare
26e16b6
to
0b6efef
Compare
0b6efef
to
26e16b6
Compare
75b234c
to
b1e2d9f
Compare
b1e2d9f
to
7a3e313
Compare
7a3e313
to
e37669f
Compare
The data FIFO module did not have a deinitialize function so added one, with a twister test. Signed-off-by: Graham Wacey <graham.wacey@nordicsemi.no>
e37669f
to
8446112
Compare
The data FIFO module did not have a deinitialise function, so added one, with a twister test.