Removing dead code
cover 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(-)
PATCH 1/3 sound/oss: Remove dead CONFIG_SOFTOSS*
CONFIG_SOFTOSS* doesn't exist in Kconfig or somewhere else, therefore removing all references for it from the source code.
--- sound/oss/vidc.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
sound/oss/vidc.c +0 -3
@@ -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:
Signature · 1 line
1.7.0.4
Takashi Iwai
AppliedRe: [PATCH 1/3] sound/oss: Remove dead CONFIG_SOFTOSS*
At Wed, 21 Jul 2010 14:35:17 +0200,
Quoted 5 lines · Christian Dietrich
CONFIG_SOFTOSS* doesn't exist in
Kconfigor somewhere else, therefore removing all references for it from the source code.Signed-off-by Christian Dietrich <[email protected]>
Applied this one. Thanks.
Takashi
Quoted 21 lines
--- sound/oss/vidc.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)sound/oss/vidc.c +0
-3@@ -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:Signature · 1 line
1.7.0.4
PATCH 2/3 sound/soc/atmel: Remove dead CONFIG_AT32_ENHANCED_PORTMUX
In reply to Christian DietrichCONFIG_AT32_ENCHANCED_PORTMUX doesn't exist in Kconfig or somewhere else, therefore removing all references for it from the source code.
--- sound/soc/atmel/playpaq_wm8510.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-)
sound/soc/atmel/playpaq_wm8510.c +0 -9
@@ -425,11 +425,6 @@ static int __init playpaq_asoc_init(void)clk_set_rate (CODEC_CLK ,12000000 );clk_enable (CODEC_CLK ); -#if definedCONFIG_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 definedCONFIG_AT32_ENHANCED_PORTMUX -at32_free_pin (MCLK_PIN ); -#endif -platform_device_unregister (playpaq_snd_device); playpaq_snd_device =NULL ; }
Signature · 1 line
1.7.0.4
Re: [PATCH 2/3] sound/soc/atmel: Remove dead CONFIG_AT32_ENHANCED_PORTMUX
Quoted 4 lines · Christian Dietrich
CONFIG_AT32_ENCHANCED_PORTMUXdoesn't exist inKconfigor somewhere else, therefore removing all references for it from the source code.Signed-off-by Christian Dietrich <[email protected]>
Please remember to CC maintainers on patches - I've added Geoffrey.
Quoted 34 lines
--- sound/soc/atmel/playpaq_wm8510.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-)sound/soc/atmel/playpaq_wm8510.c +0
-9@@ -425,11 +425,6 @@ static int __init playpaq_asoc_init(void)clk_set_rate (CODEC_CLK ,12000000 );clk_enable (CODEC_CLK ); -#if definedCONFIG_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 definedCONFIG_AT32_ENHANCED_PORTMUX -at32_free_pin (MCLK_PIN ); -#endif -platform_device_unregister (playpaq_snd_device); playpaq_snd_device =NULL ; }Signature · 1 line
1.7.0.4
PATCH 3/3 sound/isa/gus: Remove dead CONFIG_SND_DEBUG_ROM
In reply to Christian DietrichCONFIG_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_
--- sound/isa/gus/interwave.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)
sound/isa/gus/interwave.c +0 -8
@@ -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++;
Signature · 1 line
1.7.0.4
Re: [PATCH 3/3] sound/isa/gus: Remove dead CONFIG_SND_DEBUG_ROM
At Wed, 21 Jul 2010 14:36:02 +0200,
Quoted 6 lines · Christian Dietrich
CONFIG_SND_DEBUG_ROMdoesn't exist inKconfig, 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 namedCONFIG_Signed-off-by Christian Dietrich <[email protected]>
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
Quoted 31 lines
--- sound/isa/gus/interwave.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-)sound/isa/gus/interwave.c +0
-8@@ -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++;Signature · 1 line
1.7.0.4