Skip to contentSkip to conversation

sound/pci/hda/patch_realtek.c: remove dead code

RFC PATCH In review Adrian Bunk 2 participants 4 messages Jun 15, 2007 – Jul 2, 2007 Sound

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 sound/pci/hda/patch_realtek.c: remove dead code

This patch removes dead code spotted by the Coverity checker.

---

 sound/pci/hda/patch_realtek.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
sound/pci/hda/patch_realtek.c renamed from sound/pci/hda/patch_realtek.c.old +2 -5
@@ -10704,30 +10704,31 @@ static struct hda_verb alc662_init_verbs
 	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
 	/* Input mixer */
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
 	{ }
 };
 
 static struct hda_verb alc662_sue_init_verbs[] = {
 	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
 	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
         {}
 };
 
+#if 0
 /*
  * generic initialization of ADC, input mixers and output mixers
  */
 static struct hda_verb alc662_auto_init_verbs[] = {
 	/*
 	 * Unmute ADC and set the default input to mic-in
 	 */
 	{0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
 	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 
 	/* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
 	 * mixer widget
 	 * Note: PASD motherboards uses the Line In 2 as the input for front
 	 * panel mic (mic 2)
 	 */
@@ -10755,30 +10756,31 @@ static struct hda_verb alc662_auto_init_
 	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 
 
 	/* FIXME: use matrix-type input source selection */
 	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
 	/* Input mixer */
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
 	/*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/
 	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
 
 	{ }
 };
+#endif  /*  0  */
 
 /* capture mixer elements */
 static struct snd_kcontrol_new alc662_capture_mixer[] = {
 	HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
 	HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 		/* The multiple "Capture Source" controls confuse alsamixer
 		 * So call somewhat different..
 		 * FIXME: the controls appear in the "playback" view!
 		 */
 		/* .name = "Capture Source", */
 		.name = "Input Source",
 		.count = 1,
 		.info = alc882_mux_enum_info,
@@ -11152,35 +11154,30 @@ static int alc662_parse_auto_config(stru
 	err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
 	if (err < 0)
 		return err;
 
 	spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
 	if (spec->autocfg.dig_out_pin)
 		spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
 
 	if (spec->kctl_alloc)
 		spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
 
 	spec->num_mux_defs = 1;
 	spec->input_mux = &spec->private_imux;
 	
-	if (err < 0)
-		return err;
-	else if (err > 0)
-		/* hack - override the init verbs */
-		spec->init_verbs[0] = alc662_auto_init_verbs;
 	spec->mixers[spec->num_mixers] = alc662_capture_mixer;
 	spec->num_mixers++;
 	return err;
 }
 
 /* additional initialization for auto-configuration model */
 static void alc662_auto_init(struct hda_codec *codec)
 {
 	alc662_auto_init_multi_out(codec);
 	alc662_auto_init_hp_out(codec);
 	alc662_auto_init_analog_input(codec);
 }
 
 static int patch_alc662(struct hda_codec *codec)
 {
#1 lore raw

At Fri, 15 Jun 2007 23:45:31 +0200,

Quoted 4 lines · Adrian Bunk

This patch removes dead code spotted by the Coverity checker.

This appears to be a copy-and-paste error from other auto-configuration code. I fixed it on ALSA tree now so that it'll be merged to the next mm...

thanks,

Takashi

Quoted 109 lines

---

 sound/pci/hda/patch_realtek.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
sound/pci/hda/patch_realtek.c renamed from sound/pci/hda/patch_realtek.c.old +2 -5
@@ -10704,30 +10704,31 @@ static struct hda_verb alc662_init_verbs
 	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
 	/* Input mixer */
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
 	{ }
 };
 
 static struct hda_verb alc662_sue_init_verbs[] = {
 	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
 	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
         {}
 };
 
+#if 0
 /*
  * generic initialization of ADC, input mixers and output mixers
  */
 static struct hda_verb alc662_auto_init_verbs[] = {
 	/*
 	 * Unmute ADC and set the default input to mic-in
 	 */
 	{0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
 	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 
 	/* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
 	 * mixer widget
 	 * Note: PASD motherboards uses the Line In 2 as the input for front
 	 * panel mic (mic 2)
 	 */
@@ -10755,30 +10756,31 @@ static struct hda_verb alc662_auto_init_
 	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 
 
 	/* FIXME: use matrix-type input source selection */
 	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
 	/* Input mixer */
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
 	/*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/
 	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
 
 	{ }
 };
+#endif  /*  0  */
 
 /* capture mixer elements */
 static struct snd_kcontrol_new alc662_capture_mixer[] = {
 	HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
 	HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 		/* The multiple "Capture Source" controls confuse alsamixer
 		 * So call somewhat different..
 		 * FIXME: the controls appear in the "playback" view!
 		 */
 		/* .name = "Capture Source", */
 		.name = "Input Source",
 		.count = 1,
 		.info = alc882_mux_enum_info,
@@ -11152,35 +11154,30 @@ static int alc662_parse_auto_config(stru
 	err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
 	if (err < 0)
 		return err;
 
 	spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
 	if (spec->autocfg.dig_out_pin)
 		spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
 
 	if (spec->kctl_alloc)
 		spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
 
 	spec->num_mux_defs = 1;
 	spec->input_mux = &spec->private_imux;
 
-	if (err < 0)
-		return err;
-	else if (err > 0)
-		/* hack - override the init verbs */
-		spec->init_verbs[0] = alc662_auto_init_verbs;
 	spec->mixers[spec->num_mixers] = alc662_capture_mixer;
 	spec->num_mixers++;
 	return err;
 }
 
 /* additional initialization for auto-configuration model */
 static void alc662_auto_init(struct hda_codec *codec)
 {
 	alc662_auto_init_multi_out(codec);
 	alc662_auto_init_hp_out(codec);
 	alc662_auto_init_analog_input(codec);
 }
 
 static int patch_alc662(struct hda_codec *codec)
 {
#2 lore raw

PATCH 1/1 sound/pci/hda/patch_realtek.c: remove dead code

Quoted 10 lines · Takashi Iwai

At Fri, 15 Jun 2007 23:45:31 +0200,

Quoted 4 lines · Adrian Bunk

This patch removes dead code spotted by the Coverity checker.

This appears to be a copy-and-paste error from other auto-configuration code. I fixed it on ALSA tree now so that it'll be merged to the next mm...

Thanks.

The patch below removes the remaining and really dead code.

Quoted 3 lines

thanks,

Takashi

cu
Adrian

<-- snip -->

This patch removes some dead code spotted by the Coverity checker.

---

 sound/pci/hda/patch_realtek.c |    2 --
 1 file changed, 2 deletions(-)
sound/pci/hda/patch_realtek.c renamed from sound/pci/hda/patch_realtek.c.old +0 -2
@@ -11170,32 +11170,30 @@ static int alc662_parse_auto_config(stru
 	err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
 	if (err < 0)
 		return err;
 
 	spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
 	if (spec->autocfg.dig_out_pin)
 		spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
 
 	if (spec->kctl_alloc)
 		spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
 
 	spec->num_mux_defs = 1;
 	spec->input_mux = &spec->private_imux;
 	
-	if (err < 0)
-		return err;
 	spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
 	spec->mixers[spec->num_mixers] = alc662_capture_mixer;
 	spec->num_mixers++;
 	return 1;
 }
 
 /* additional initialization for auto-configuration model */
 static void alc662_auto_init(struct hda_codec *codec)
 {
 	alc662_auto_init_multi_out(codec);
 	alc662_auto_init_hp_out(codec);
 	alc662_auto_init_analog_input(codec);
 }
 
 static int patch_alc662(struct hda_codec *codec)
#3 lore raw

At Sun, 1 Jul 2007 22:21:18 +0200,

Quoted 9 lines · Adrian Bunk
Quoted 7 lines · Takashi Iwai

At Fri, 15 Jun 2007 23:45:31 +0200,

Quoted 4 lines · Adrian Bunk

This patch removes dead code spotted by the Coverity checker.

Quoted 7 lines
Quoted 3 lines

This appears to be a copy-and-paste error from other auto-configuration code. I fixed it on ALSA tree now so that it'll be merged to the next mm...

Thanks.

The patch below removes the remaining and really dead code.

Oh, yeah, thanks. Merged to ALSA tree now.

Takashi