casaroli opened a new pull request, #21562:
URL: https://github.com/apache/nuttx/pull/21562

   ## Summary
   
   `audio_null_initialize()` set `priv->playback` after the `return` of the 
success path, so the flag was never set. Every null audio device reported an 
input unit (`AUDIO_TYPE_INPUT`) in `AUDIOIOC_GETCAPS`, also a device made for 
playback. When `kmm_zalloc()` failed, the function wrote through a NULL 
pointer. The fix sets the flag before the return. A second commit gives 
samv71-xult the `playback` argument: its call has had no argument since the 
parameter was added in 553cf84a7b2, so `sam_audio_null.c` did not compile. The 
first commit fixes older nxstyle errors in `audio_null.c` (whitespace only), 
which the CI check reports for the whole file.
   
   ## Impact
   
   A null device made with `audio_null_initialize(true)` (sama5d4-ek, 
samv71-xult) now reports an output unit, so a player that looks for an output 
device finds it. A device made with `false` is unchanged. `sam_audio_null.c` of 
samv71-xult compiles again. No Documentation change. All build modes and arches 
use the same driver code.
   
   ## Testing
   
   - Test program `audionull.c` (opens the device and reads `AUDIOIOC_GETCAPS` 
with `AUDIO_TYPE_QUERY`), on qemu-armv8a with `CONFIG_AUDIO_NULL` and a local 
board patch that registers `audio_null_initialize(true)` as `/dev/audio/null0` 
(the patch is not part of this PR). The arm64 images need 
`-Wno-error=format-truncation`: `mqname[16]` in `audio_null.c` is too small for 
`"/tmp/%" PRIXPTR` with 64-bit pointers, an older problem that this PR does not 
change. master: the device reports 0x01 (input), FAIL. This PR: 0x02 (output), 
PASS.
   - ostest on the same images: qemu-armv8a:knsh (kernel build) exit 0, 
qemu-armv8a:nsh (flat build) exit 0, arm64, QEMU with HVF.
   - samv71-xult:nsh with `CONFIG_AUDIO_NULL` and the WM8904 options (Make, 
`-Wno-cpp -Werror`): master fails in `sam_audio_null.c` (too few arguments to 
`audio_null_initialize`); with this PR `audio_null.c` and `sam_audio_null.c` 
compile without errors. The board still does not link because of two older 
errors in `sam_wm8904.c` (`CONFIG_SAMV7D4EK_WM8904_I2CFREQUENCY` and 
`BOARD_MAINCK_FREQUENCY` are not defined), which this PR does not change.
   - sama5d4-ek:nxwm (the only defconfig with `CONFIG_AUDIO_NULL`): 
`audio_null.c` compiles without errors. The board fails on master and with this 
PR in the same 9 places of the sama5 chip code (`sam_mck_frequency` not 
declared), which this PR does not change.
   - Not run: no samv71-xult or sama5d4-ek hardware.
   - checkpatch: `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to