Skip to contentSkip to conversation

ALSA: hda: generic: Remove redundant assignment to dac and dacs[i]

PATCH Superseded Jiapeng Chong 2 participants 2 messages May 10, 2021 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda: generic: Remove redundant assignment to dac and dacs[i]

Variable dac and dacs[i] is set to zero, but this value is never read as it is overwritten or not used later on, hence it is a redundant assignment and can be removed.

Clean up the following clang-analyzer warning:

sound/pci/hda/hda_generic.c:1436:4: warning: Value stored to 'dac' is never read [clang-analyzer-deadcode.DeadStores].

---
 sound/pci/hda/hda_generic.c | 1 -
 1 file changed, 1 deletion(-)
sound/pci/hda/hda_generic.c +0 -1
index b638fc2..cce1bf7 100644
@@ -1433,7 +1433,6 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
 			path = snd_hda_add_new_path(codec, dac, pin, 0);
 		}
 		if (!path) {
-			dac = dacs[i] = 0;
 			badness += bad->no_dac;
 		} else {
 			/* print_nid_path(codec, "output", path); */
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 21 lines · Jiapeng Chong

Variable dac and dacs[i] is set to zero, but this value is never read as it is overwritten or not used later on, hence it is a redundant assignment and can be removed.

Clean up the following clang-analyzer warning:

sound/pci/hda/hda_generic.c:1436:4: warning: Value stored to 'dac' is never read [clang-analyzer-deadcode.DeadStores].

---
  sound/pci/hda/hda_generic.c | 1 -
  1 file changed, 1 deletion(-)
sound/pci/hda/hda_generic.c +0 -0
index b638fc2..cce1bf7 100644

sound/pci/hda/hda_generic.c static int try_assign_dacs(struct hda_codec *codec, int num_outs, · line 1438

Quoted 7 lines
sound/pci/hda/hda_generic.c +0 -1
@@ -1433,7 +1433,6 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
  			path = snd_hda_add_new_path(codec, dac, pin, 0);
  		}
  		if (!path) {
-			dac = dacs[i] = 0;
  			badness += bad->no_dac;
  		} else {
  			/* print_nid_path(codec, "output", path); */

Not entirely true... dacs is passed by pointer, so value assigned to it can be used somewhere else.