-
Notifications
You must be signed in to change notification settings - Fork 8.3k
drivers: i2s: nrf_tdm: Add guards for buffers size #100288
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: i2s: nrf_tdm: Add guards for buffers size #100288
Conversation
f31fdd2 to
22e1dc0
Compare
b555fef to
9c34500
Compare
drivers/i2s/i2s_nrf_tdm.c
Outdated
| tdm_cfg->block_size <= NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED) { | ||
| LOG_ERR("This device can only transmit full 32-bit words greater than %u bytes.", | ||
| NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED); | ||
| return -EIO; |
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.
i2s_configure() can not return -EIO. It must be -EINVAL.
See API documentation https://docs.zephyrproject.org/latest/doxygen/html/group__i2s__interface.html#ga299003d72146c127f88d7c12c08889cc
Same in line 692 and ?686?.
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.
Argh.
I didn't noticed that lines 692 and 686 are in i2s_write() function which instead shall return -EIO while it can't return -EINVAL.
https://docs.zephyrproject.org/latest/doxygen/html/group__i2s__interface.html#ga01edf23acc6c16bbaf718dab8061a7a0
Thus, line 487 -> shall be -EINVAL
lines 692 and 686 -> shall be -EIO
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.
Please align test if needed:
https://github.com/zephyrproject-rtos/zephyr/blob/main/tests/drivers/i2s/i2s_additional/src/main.c#L763
If I understand, once you align with Sebastian suggestion, there is not need to change test. |
15cac1c
9c34500 to
15cac1c
Compare
TDM peripheral requires TXD.MAXCNT and RXD.MAXCNT registers to be: - multiple of 4 bytes - larger than 8 bytes Signed-off-by: Adam Kondraciuk <[email protected]>
15cac1c to
5be6e2e
Compare
|
Works in CI |
|



TDM peripheral requires TXD.MAXCNT and RXD.MAXCNT registers to be: