[alsa-devel] [PATCH 0/3] Removing dead code
Hi all!
As part of the VAMOS[0] research project at the University of Erlangen we are looking at multiple integrity errors in linux' configuration system.
I've been running a check on the sound/ sourcetree for config Items not defined in Kconfig and found 3 such cases. Sourcecode blocks depending on these Items are not reachable from a vanilla kernel -- dead code. I've seen such dead blocks made on purpose e.g. while integrating new features into the kernel but generally they're just useless.
Each of the patches in this patchset removes on such dead config Item, I'd be glad if you consider applying them. I've been doing deeper analysis of such issues before and can do so again but I'm not so sure they were fastly usefull.
I build the patches against a vanilla kernel in order to try if the kernel compiles with this patches
Please keep me informed of this patch getting confirmed / merged so we can keep track of it.
Regards
Christian Dietrich
[0] http://vamos1.informatik.uni-erlangen.de/
Christian Dietrich (3): sound/oss: Remove dead CONFIG_SOFTOSS* sound/soc/atmel: Remove dead CONFIG_AT32_ENHANCED_PORTMUX sound/isa/gus: Remove dead CONFIG_SND_DEBUG_ROM
sound/isa/gus/interwave.c | 8 -------- sound/oss/vidc.c | 3 --- sound/soc/atmel/playpaq_wm8510.c | 9 --------- 3 files changed, 0 insertions(+), 20 deletions(-)
CONFIG_SOFTOSS* doesn't exist in Kconfig or somewhere else, therefore removing all references for it from the source code.
Signed-off-by: Christian Dietrich qy03fugy@stud.informatik.uni-erlangen.de --- sound/oss/vidc.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/sound/oss/vidc.c b/sound/oss/vidc.c index ac39a53..f0e0caa 100644 --- a/sound/oss/vidc.c +++ b/sound/oss/vidc.c @@ -491,9 +491,6 @@ static void __init attach_vidc(struct address_info *hw_config) vidc_adev = adev; vidc_mixer_set(SOUND_MIXER_VOLUME, (85 | 85 << 8));
-#if defined(CONFIG_SOUND_SOFTOSS) || defined(CONFIG_SOUND_SOFTOSS_MODULE) - softoss_dev = adev; -#endif return;
irq_failed:
At Wed, 21 Jul 2010 14:35:17 +0200, Christian Dietrich wrote:
CONFIG_SOFTOSS* doesn't exist in Kconfig or somewhere else, therefore removing all references for it from the source code.
Signed-off-by: Christian Dietrich qy03fugy@stud.informatik.uni-erlangen.de
Applied this one. Thanks.
Takashi
sound/oss/vidc.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/sound/oss/vidc.c b/sound/oss/vidc.c index ac39a53..f0e0caa 100644 --- a/sound/oss/vidc.c +++ b/sound/oss/vidc.c @@ -491,9 +491,6 @@ static void __init attach_vidc(struct address_info *hw_config) vidc_adev = adev; vidc_mixer_set(SOUND_MIXER_VOLUME, (85 | 85 << 8));
-#if defined(CONFIG_SOUND_SOFTOSS) || defined(CONFIG_SOUND_SOFTOSS_MODULE)
- softoss_dev = adev;
-#endif return;
irq_failed:
1.7.0.4
CONFIG_AT32_ENCHANCED_PORTMUX doesn't exist in Kconfig or somewhere else, therefore removing all references for it from the source code.
Signed-off-by: Christian Dietrich qy03fugy@stud.informatik.uni-erlangen.de --- sound/soc/atmel/playpaq_wm8510.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/sound/soc/atmel/playpaq_wm8510.c b/sound/soc/atmel/playpaq_wm8510.c index 9df4c68..fbd17e9 100644 --- a/sound/soc/atmel/playpaq_wm8510.c +++ b/sound/soc/atmel/playpaq_wm8510.c @@ -425,11 +425,6 @@ static int __init playpaq_asoc_init(void) clk_set_rate(CODEC_CLK, 12000000); clk_enable(CODEC_CLK);
-#if defined CONFIG_AT32_ENHANCED_PORTMUX - at32_select_periph(MCLK_PIN, MCLK_PERIPH, 0); -#endif - - /* * Create and register platform device */ @@ -496,10 +491,6 @@ static void __exit playpaq_asoc_exit(void) _pll0 = NULL; }
-#if defined CONFIG_AT32_ENHANCED_PORTMUX - at32_free_pin(MCLK_PIN); -#endif - platform_device_unregister(playpaq_snd_device); playpaq_snd_device = NULL; }
On Wed, Jul 21, 2010 at 02:35:41PM +0200, Christian Dietrich wrote:
CONFIG_AT32_ENCHANCED_PORTMUX doesn't exist in Kconfig or somewhere else, therefore removing all references for it from the source code.
Signed-off-by: Christian Dietrich qy03fugy@stud.informatik.uni-erlangen.de
Please remember to CC maintainers on patches - I've added Geoffrey.
sound/soc/atmel/playpaq_wm8510.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/sound/soc/atmel/playpaq_wm8510.c b/sound/soc/atmel/playpaq_wm8510.c index 9df4c68..fbd17e9 100644 --- a/sound/soc/atmel/playpaq_wm8510.c +++ b/sound/soc/atmel/playpaq_wm8510.c @@ -425,11 +425,6 @@ static int __init playpaq_asoc_init(void) clk_set_rate(CODEC_CLK, 12000000); clk_enable(CODEC_CLK);
-#if defined CONFIG_AT32_ENHANCED_PORTMUX
- at32_select_periph(MCLK_PIN, MCLK_PERIPH, 0);
-#endif
- /*
*/
- Create and register platform device
@@ -496,10 +491,6 @@ static void __exit playpaq_asoc_exit(void) _pll0 = NULL; }
-#if defined CONFIG_AT32_ENHANCED_PORTMUX
- at32_free_pin(MCLK_PIN);
-#endif
- platform_device_unregister(playpaq_snd_device); playpaq_snd_device = NULL;
}
1.7.0.4
CONFIG_SND_DEBUG_ROM doesn't exist in Kconfig, therefore it is never defined and we can remove all references to it. If it should stay as a debug flag, perhaps it shouldn't be named CONFIG_
Signed-off-by: Christian Dietrich qy03fugy@stud.informatik.uni-erlangen.de --- sound/isa/gus/interwave.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index c7b80e4..ac60c7d 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -442,19 +442,11 @@ static void __devinit snd_interwave_detect_memory(struct snd_gus_card * gus) for (bank_pos = 0; bank_pos < 16L * 1024L * 1024L; bank_pos += 4L * 1024L * 1024L) { for (i = 0; i < 8; ++i) iwave[i] = snd_gf1_peek(gus, bank_pos + i); -#ifdef CONFIG_SND_DEBUG_ROM - printk(KERN_DEBUG "ROM at 0x%06x = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", bank_pos, - iwave[0], iwave[1], iwave[2], iwave[3], - iwave[4], iwave[5], iwave[6], iwave[7]); -#endif if (strncmp(iwave, "INTRWAVE", 8)) continue; /* first check */ csum = 0; for (i = 0; i < sizeof(struct rom_hdr); i++) csum += snd_gf1_peek(gus, bank_pos + i); -#ifdef CONFIG_SND_DEBUG_ROM - printk(KERN_DEBUG "ROM checksum = 0x%x (computed)\n", csum); -#endif if (csum != 0) continue; /* not valid rom */ gus->gf1.rom_banks++;
At Wed, 21 Jul 2010 14:36:02 +0200, Christian Dietrich wrote:
CONFIG_SND_DEBUG_ROM doesn't exist in Kconfig, therefore it is never defined and we can remove all references to it. If it should stay as a debug flag, perhaps it shouldn't be named CONFIG_
Signed-off-by: Christian Dietrich qy03fugy@stud.informatik.uni-erlangen.de
This is rather a debug code, so it's often useful to keep as is. At bets, we can rename the ifdef without CONFIG_ prefix.
thanks,
Takashi
sound/isa/gus/interwave.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index c7b80e4..ac60c7d 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -442,19 +442,11 @@ static void __devinit snd_interwave_detect_memory(struct snd_gus_card * gus) for (bank_pos = 0; bank_pos < 16L * 1024L * 1024L; bank_pos += 4L * 1024L * 1024L) { for (i = 0; i < 8; ++i) iwave[i] = snd_gf1_peek(gus, bank_pos + i); -#ifdef CONFIG_SND_DEBUG_ROM
printk(KERN_DEBUG "ROM at 0x%06x = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", bank_pos,
iwave[0], iwave[1], iwave[2], iwave[3],
iwave[4], iwave[5], iwave[6], iwave[7]);
-#endif if (strncmp(iwave, "INTRWAVE", 8)) continue; /* first check */ csum = 0; for (i = 0; i < sizeof(struct rom_hdr); i++) csum += snd_gf1_peek(gus, bank_pos + i); -#ifdef CONFIG_SND_DEBUG_ROM
printk(KERN_DEBUG "ROM checksum = 0x%x (computed)\n", csum);
-#endif if (csum != 0) continue; /* not valid rom */ gus->gf1.rom_banks++; -- 1.7.0.4
participants (3)
-
Christian Dietrich
-
Mark Brown
-
Takashi Iwai