]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ALSA: usb-audio: Tidy up error check for processing unit
authorRong Zhang <i@rong.moe>
Tue, 14 Apr 2026 13:29:01 +0000 (21:29 +0800)
committerTakashi Iwai <tiwai@suse.de>
Wed, 15 Apr 2026 12:28:01 +0000 (14:28 +0200)
commit37a6b2d67b0a08e5c3d2156c9178c158c3c0225f
tree2333f668ae648372b2ad1e3faca891c87a5fdccb
parent02df59d0258cd97cc60b49e5570ebfcc95ea6030
ALSA: usb-audio: Tidy up error check for processing unit

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/
Signed-off-by: Rong Zhang <i@rong.moe>
Link: https://patch.msgid.link/20260414-uac-build_auto_procunit-refactor-v1-1-afeb7efa6518@rong.moe
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer.c