[PATCH 2/2] ALSA: usx2y: Avoid WARN on a repeated DSP load

From: YuanZhe Liu

Date: Thu Oct 29 2026 - 04:48:35 EST


snd_usx2y_hwdep_dsp_load() sets up the asynchronous sequence URBs and
the interrupt URB when the FPGA firmware image (index 1) is loaded. If
a later step of the same request fails, for example the creation of the
ALSA devices, a following DSP load request from user space enters the
initialization functions for a second time.

usx2y_async_seq04_init() and usx2y_in04_init() assert with WARN_ON()
that they are called only once, so such a request triggers a kernel
warning before returning -EBUSY, although nothing is corrupted: the
functions bail out without allocating again and the leak that the check
was added for is still prevented.

Return -EBUSY without the warning.

Fixes: 02d382af1c4e ("ALSA: usx2y: Fix potential memory leaks")
Cc: stable@xxxxxxxxxxxxxxx
Co-developed-by: Bin Yu <byu@xxxxxxxxxxxxx>
Signed-off-by: Bin Yu <byu@xxxxxxxxxxxxx>
Co-developed-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
Signed-off-by: YuanZhe Liu <25031212351@xxxxxxxxxxxxxxxxx>
---
sound/usb/usx2y/usbusx2y.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index 108f9bddf9aa..14498ce84440 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -268,7 +268,7 @@ int usx2y_async_seq04_init(struct usx2ydev *usx2y)
{
int err = 0, i;

- if (WARN_ON(usx2y->as04.buffer))
+ if (usx2y->as04.buffer)
return -EBUSY;

usx2y->as04.buffer = kmalloc_array(URBS_ASYNC_SEQ,
@@ -300,7 +300,7 @@ int usx2y_in04_init(struct usx2ydev *usx2y)
{
int err;

- if (WARN_ON(usx2y->in04_urb))
+ if (usx2y->in04_urb)
return -EBUSY;

usx2y->in04_urb = usb_alloc_urb(0, GFP_KERNEL);
--
2.34.1