public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Remove redundant assignment to len
@ 2021-04-27 10:26 Jiapeng Chong
  2021-04-28 10:25 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-04-27 10:26 UTC (permalink / raw)
  To: perex; +Cc: tiwai, alsa-devel, linux-kernel, 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.

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(-)

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;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Remove redundant assignment to len
  2021-04-27 10:26 [PATCH] ALSA: usb-audio: Remove redundant assignment to len Jiapeng Chong
@ 2021-04-28 10:25 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-04-28 10:25 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: perex, tiwai, alsa-devel, linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-28 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-27 10:26 [PATCH] ALSA: usb-audio: Remove redundant assignment to len Jiapeng Chong
2021-04-28 10:25 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox