Re: [PATCH] usb: gadget: f_uac1: fix ac_header_desc in descriptor lists
From: Aldo Ariel Panzardo
Date: Fri Oct 09 2026 - 22:29:30 EST
On Thu, Oct 01, 2026 at 07:58:08AM +0000, Paritosh Potukuchi wrote:
> Store ac_header_desc instead of &ac_header_desc in both
> f_audio_desc and f_audio_ss_desc.
This doesn't build. f_audio_desc[] and f_audio_ss_desc[] are file-scope
arrays, so their initializers must be constant expressions.
&ac_header_desc is an address constant and is fine; ac_header_desc reads
the value of a mutable pointer, which is not a constant expression, so
both changed entries fail with "initializer element is not constant".
It also touches the array that isn't the problem. f_audio_desc[] (FS/HS)
is rebuilt entry by entry in afunc_bind() after the descriptor is
allocated, so its static initializer never reaches the core. The entry
that does reach the core unchanged is in f_audio_ss_desc[] (SS/SSP),
which is never rebuilt -- that is where &ac_header_desc is handed to
usb_copy_descriptors() and the pointer variable itself gets read as a
descriptor header.
So the fix belongs at run time rather than in the static initializer:
the f_audio_ss_desc[] AC-header slot needs to be set from ac_header_desc
after build_ac_header_desc() succeeds and before
usb_assign_descriptors(), the same way f_audio_desc[] is already built.
(Putting ac_header_desc in the static initializer would capture NULL
anyway, since it is only allocated in afunc_bind().)
Thanks,
Aldo