# SDL: PS2: Preserve real-error detection in PlayDevice (follow-up to #16413)

**URL:** <https://discourse.libsdl.org/t/sdl-ps2-preserve-real-error-detection-in-playdevice-follow-up-to-16413/69446>\
**Category:** SDL Commits\
**Created:** [October 1, 2026, 7:07pm UTC](https://discourse.libsdl.org/t/sdl-ps2-preserve-real-error-detection-in-playdevice-follow-up-to-16413/69446 "2026-10-01T19:07:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [October 1, 2026, 7:07pm UTC](https://discourse.libsdl.org/t/sdl-ps2-preserve-real-error-detection-in-playdevice-follow-up-to-16413/69446/1 "2026-10-01T19:07:12Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/766d798f5a67c224cf5628ed236224123689e66b>
>
> \#16413 fixed the zombie-device bug by ignoring audsrv\_play\_audio()'s
> return valu…e entirely. That also silently swallows its one real error
> case: a negative return when audsrv isn't initialized
> (-AUDSRV\_ERR\_NOT\_INITIALIZED, iop/sound/audsrv/src/audsrv.c). Keep
> treating a negative return as fatal; a short write is still tolerated
> as the normal, by-design case it is.

```diff
From 766d798f5a67c224cf5628ed236224123689e66b Mon Sep 17 00:00:00 2001
From: Ifcaro <[EMAIL REDACTED]>
Date: Thu, 1 Oct 2026 17:51:50 +0200
Subject: [PATCH] PS2: Preserve real-error detection in PlayDevice (follow-up
 to #16413)

#16413 fixed the zombie-device bug by ignoring audsrv_play_audio()'s
return value entirely. That also silently swallows its one real error
case: a negative return when audsrv isn't initialized
(-AUDSRV_ERR_NOT_INITIALIZED, iop/sound/audsrv/src/audsrv.c). Keep
treating a negative return as fatal; a short write is still tolerated
as the normal, by-design case it is.
---
 src/audio/ps2/SDL_ps2audio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/audio/ps2/SDL_ps2audio.c b/src/audio/ps2/SDL_ps2audio.c
index 92dc78b9fcd07..2b015489f1c04 100644
--- a/src/audio/ps2/SDL_ps2audio.c
+++ b/src/audio/ps2/SDL_ps2audio.c
@@ -89,10 +89,9 @@ static bool PS2AUDIO_OpenDevice(SDL_AudioDevice *device)
 
 static bool PS2AUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buflen)
 {
- // We assume it's working by default. In case if we throw error
- // audio device will be removed and never recreated.
- audsrv_play_audio((char *)buffer, buflen);
- return true;
+ // A short write is normal (ring buffer momentarily full), not an error -
+ // only a negative return (e.g. audsrv not initialized) is.
+ return audsrv_play_audio((char *)buffer, buflen) >= 0;
 }
 
 static bool PS2AUDIO_WaitDevice(SDL_AudioDevice *device)

```
