Re: [PATCH] ALSA: usb-audio: Tidy up error check for processing unit

From: Takashi Iwai

Date: Wed Apr 15 2026 - 08:29:30 EST


On Tue, 14 Apr 2026 15:29:01 +0200,
Rong Zhang wrote:
>
> There are two duplicated code paths calling get_min_max() with the same
> arguments in build_audio_procunit(). This once led to a failure to
> notice a code path that caused the `err' variable uninitialized when
> adding error checks for callers of get_min_max*() [1].
>
> Move cases in the switch-case statement to tidy up the error check by
> merging the duplicated code paths together with a fallthrough attribute.
> This also eliminates the `err = 0' lines and aggregates the error check
> along with the corresponding call together, so that the intent of these
> code paths is clearer.
>
> The refactor also has an interesting effect that shrinks the .text size
> by 16 bytes (GCC 15 amd64). It seems that the compiler was unable to
> perform dead code elimination for the `err = 0' paths before.
>
> Link: https://lore.kernel.org/r/ad36dGpCBTGsyFr_@stanley.mountain/ [1]
> Signed-off-by: Rong Zhang <i@xxxxxxxx>

Applied now. Thanks.


Takashi