apache / apache/nuttx

[BUG] I2S operations are not adhered to by lower-half implementations

Open
#19,309 5 comments 1 reaction 2 assignees Claimed by @linguini1 View on GitHub
Arch: all Area: Drivers OS: Linux Type: Bug
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

### Description / Steps to reproduce the issue

Some lower-half implementations of the I2S driver do not follow the correct return contract.

For instance, `i2s_txsamplerate` requires the return value to be the current bitrate. However, some drivers (i.e. `rp2040_i2s.c`) return 0 on success and a negated errno value on failure. This is not correct, it should be the bitrate on success.

https://github.com/apache/nuttx/blob/e9ac37e4272493d4d2e775d819b6bd9df2e90506/arch/arm/src/rp2040/rp2040_i2s.c#L737-L766

https://github.com/apache/nuttx/blob/e9ac37e4272493d4d2e775d819b6bd9df2e90506/include/nuttx/audio/i2s.h#L268-L287

### On which OS does this issue occur?

[OS: Linux]

### What is the version of your OS?

Arch Linux

### NuttX Version

master

### Issue Architecture

[Arch: all]

### Issue Area

[Area: Drivers]

### Host information

_No response_

### Verification

- [x] I have verified before submitting the report.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.