Skip to contentSkip to conversation

ALSA: usb-audio: Remove redundant assignment to len

PATCH Applied Jiapeng Chong 2 participants 2 messages Apr 27, 2021 – Apr 28, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Remove redundant assignment to len

Variable len is set to zero but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed.

Cleans up the following clang-analyzer warning:

sound/usb/mixer.c:2713:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores].

---
 sound/usb/mixer.c | 1 -
 1 file changed, 1 deletion(-)
sound/usb/mixer.c +0 -1
index b004b2e..937bc17 100644
@@ -2710,7 +2710,6 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
 #define MAX_ITEM_NAME_LEN	64
 	for (i = 0; i < desc->bNrInPins; i++) {
 		struct usb_audio_term iterm;
-		len = 0;
 		namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL);
 		if (!namelist[i]) {
 			err = -ENOMEM;
Signature · 1 line
1.8.3.1
Applied
#1 lore raw
Quoted 5 lines · Jiapeng Chong

Variable len is set to zero but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed.

Quoted 7 lines

Cleans up the following clang-analyzer warning:

sound/usb/mixer.c:2713:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores].

Thanks, applied.

Takashi