linux/sound/usb
Nathan Chancellor 9a7b7ec3c6 ALSA: usb-audio: scarlett2: Fix for loop increment in scarlett2_usb_get_config
Clang warns:

sound/usb/mixer_scarlett_gen2.c:1189:32: warning: expression result
unused [-Wunused-value]
                        for (i = 0; i < count; i++, (u16 *)buf++)
                                                    ^      ~~~~~
1 warning generated.

It appears the intention was to cast the void pointer to a u16 pointer
so that the data could be iterated through like an array of u16 values.
However, the cast happens after the increment because a cast is an
rvalue, whereas the post-increment operator only works on lvalues, so
the loop does not iterate as expected. This is not a bug in practice
because count is not greater than one at the moment but this could
change in the future so this should be fixed.

Replace the cast with a temporary variable of the proper type, which is
less error prone and fixes the iteration. Do the same thing for the
'u8 *' below this if block.

Fixes: ac34df733d ("ALSA: usb-audio: scarlett2: Update get_config to do endian conversion")
Link: https://github.com/ClangBuiltLinux/linux/issues/1408
Acked-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20210627051202.1888250-1-nathan@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-07-01 19:11:30 +02:00
..
6fire module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
bcd2000 ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
caiaq module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
hiface module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
line6 ALSA: line6: Fix racy initialization of LINE6 MIDI 2021-05-19 16:25:57 +02:00
misc module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
usx2y Merge branch 'topic/pci-rescan-prep-v2' into for-next 2021-05-25 08:50:03 +02:00
card.c ALSA: usb-audio: Skip probe of UA-101 devices 2021-04-09 09:57:30 +02:00
card.h ALSA: usb-audio: Refactoring delay account code 2021-06-02 09:01:44 +02:00
clock.c ALSA: usb-audio: Add support for Denon DN-X1600 2021-06-10 10:38:33 +02:00
clock.h ALSA: usb-audio: Constify audioformat pointer references 2020-11-23 15:15:36 +01:00
endpoint.c ALSA: usb-audio: Refactoring delay account code 2021-06-02 09:01:44 +02:00
endpoint.h ALSA: usb-audio: Remove the repeated declaration 2021-05-30 09:30:46 +02:00
format.c ALSA: usb-audio: fix rate on Ozone Z90 USB headset 2021-06-17 11:38:46 +02:00
format.h ALSA: usb: initial USB Audio Device Class 3.0 support 2018-03-21 11:46:33 +01:00
helper.c ALSA: usb-audio: Add snd_usb_get_host_interface() helper 2020-11-23 15:13:47 +01:00
helper.h ALSA: usb-audio: Add snd_usb_get_host_interface() helper 2020-11-23 15:13:47 +01:00
implicit.c ALSA: usb-audio: Generic application of implicit fb to Roland/BOSS devices 2021-04-22 18:19:47 +02:00
implicit.h ALSA: usb-audio: Factor out the implicit feedback quirk code 2020-11-23 15:17:00 +01:00
Kconfig sound: Fix Kconfig indentation 2019-10-07 03:53:03 +02:00
Makefile ALSA: usb-audio: Factor out the implicit feedback quirk code 2020-11-23 15:17:00 +01:00
media.c media: sound/usb: Use Media Controller API to share media resources 2019-04-22 11:21:06 -04:00
media.h media: sound/usb: Use Media Controller API to share media resources 2019-04-22 11:21:06 -04:00
midi.c ALSA: usb-audio: Fix potential out-of-bounce access in MIDI EP parser 2021-05-11 11:10:37 +02:00
midi.h ALSA: usb-audio: generate midi streaming substream names from jack names 2021-03-01 09:21:54 +01:00
mixer.c ALSA: usb-audio: scarlett2: Fix wrong resume call 2021-06-22 21:39:19 +02:00
mixer.h ALSA: usb-audio: scarlett2: Fix wrong resume call 2021-06-22 21:39:19 +02:00
mixer_maps.c ALSA: usb-audio: Add dB range mapping for Sennheiser Communications Headset PC 8 2021-05-03 13:35:58 +02:00
mixer_quirks.c ALSA: usb-audio: scarlett2: Add support for Solo and 2i2 Gen 3 2021-06-22 21:42:24 +02:00
mixer_quirks.h ALSA: usb-audio: Initialize Dell Dock playback volumes 2018-05-02 16:02:32 +02:00
mixer_s1810c.c ALSA: usb-audio: Fix some typos 2020-06-30 19:48:18 +02:00
mixer_s1810c.h ALSA: usb-audio: Add support for Presonus Studio 1810c 2020-02-15 09:46:16 +01:00
mixer_scarlett.c ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
mixer_scarlett.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mixer_scarlett_gen2.c ALSA: usb-audio: scarlett2: Fix for loop increment in scarlett2_usb_get_config 2021-07-01 19:11:30 +02:00
mixer_scarlett_gen2.h ALSA: usb-audio: scarlett2: Improve driver startup messages 2021-05-21 16:22:52 +02:00
mixer_us16x08.c ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
mixer_us16x08.h ALSA: usb: Constify snd_kcontrol_new items 2020-01-03 09:24:34 +01:00
pcm.c ALSA: usb-audio: Reduce latency at playback start 2021-06-02 09:02:06 +02:00
pcm.h ALSA: usb-audio: Make snd_usb_pcm_delay() static 2021-06-02 09:01:17 +02:00
power.c ALSA: usb-audio: More validations of descriptor units 2019-08-22 10:35:59 +02:00
power.h ALSA: usb-audio: Initial Power Domain support 2018-07-31 15:01:22 +02:00
proc.c ALSA: usb-audio: Show sync endpoint information in proc outputs 2020-11-23 15:16:45 +01:00
proc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
quirks-table.h ALSA: usb-audio: Add support for Denon DN-X1600 2021-06-10 10:38:33 +02:00
quirks.c ALSA: usb-audio: DJM-750: ensure format is set 2021-04-19 09:42:35 +02:00
quirks.h ALSA: usb-audio: Constify audioformat pointer references 2020-11-23 15:15:36 +01:00
stream.c Merge branch 'for-linus' into for-next 2020-12-14 09:05:29 +01:00
stream.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
usbaudio.h ALSA: usb-audio: Apply implicit feedback mode for BOSS devices 2021-04-14 14:24:22 +02:00
validate.c ALSA: usb-audio: Fix endianess in descriptor validation 2020-02-01 09:06:11 +01:00