diff mbox series

ALSA: usb-audio: Remove redundant assignment to len

Message ID 1619519194-57806-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive)
State Accepted
Commit a3ffcebc87480664aef7c8283394d4cf2aec327c
Headers show
Series ALSA: usb-audio: Remove redundant assignment to len | expand

Commit Message

Jiapeng Chong April 27, 2021, 10:26 a.m. UTC
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].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 sound/usb/mixer.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Takashi Iwai April 28, 2021, 10:25 a.m. UTC | #1
On Tue, 27 Apr 2021 12:26:34 +0200,
Jiapeng Chong wrote:
> 
> 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].
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Thanks, applied.


Takashi
diff mbox series

Patch

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index b004b2e..937bc17 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -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;