Skip to contentSkip to conversation

Fix arch/x86/kernel/cpu/mtrr/main.c build warning

PATCH New Richard A. Holden III 4 participants 8 messages Nov 20, 2008 – Nov 24, 2008

Subsystems (6)
x86 Sound Linux-next tree ASoC +2 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix arch/x86/kernel/cpu/mtrr/main.c build warning

Fix
arch/x86/kernel/cpu/mtrr/main.c: In function 'mtrr_bp_init':
arch/x86/kernel/cpu/mtrr/main.c:1364: warning: 'gran_base' may be used uninitialized in this function

gran_base is only used within the if (debug_print) sections of the for loop, so combine both sections and move the declaration to within if (debug_print). The overhead of to_size_factor may be a consideration but the compiler should be able to optimize out the multiple calls.

---
 arch/x86/kernel/cpu/mtrr/main.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
arch/x86/kernel/cpu/mtrr/main.c +3 -7
index c091d06..b751e3a 100644
@@ -1360,20 +1360,16 @@ static int __init mtrr_cleanup(unsigned address_bits)
 	memset(min_loss_pfn, 0xff, sizeof(min_loss_pfn));
 	memset(result, 0, sizeof(result));
 	for (gran_size = (1ULL<<16); gran_size < (1ULL<<32); gran_size <<= 1) {
-		char gran_factor;
-		unsigned long gran_base;
-
-		if (debug_print)
-			gran_base = to_size_factor(gran_size >> 10, &gran_factor);
 
 		for (chunk_size = gran_size; chunk_size < (1ULL<<32);
 		     chunk_size <<= 1) {
 			int num_reg;
 
 			if (debug_print) {
-				char chunk_factor;
-				unsigned long chunk_base;
+				char gran_factor, chunk_factor;
+				unsigned long gran_base, chunk_base;
 
+				gran_base = to_size_factor(gran_size >> 10, &gran_factor);
 				chunk_base = to_size_factor(chunk_size>>10, &chunk_factor),
 				printk(KERN_INFO "\n");
 				printk(KERN_INFO "gran_size: %ld%c   chunk_size: %ld%c \n",
Signature · 1 line
1.5.6.4
#1 lore raw

PATCH 1/1 Remove unused variables from the cirrusfb driver

Remove i and s vars from cirrusfb_setup as they are not used anywhere in that function. This fixes 2 unused vars build warnings.

---
 drivers/video/cirrusfb.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/video/cirrusfb.c +1 -2
index 8a87602..a2aa6dd 100644
@@ -2462,8 +2462,7 @@ static int __init cirrusfb_init(void)
 
 #ifndef MODULE
 static int __init cirrusfb_setup(char *options) {
-	char *this_opt, s[32];
-	int i;
+	char *this_opt;
 
 	DPRINTK("ENTER\n");
 
Signature · 1 line
1.5.6.4
#2 lore raw

PATCH 1/1 Remove unused variable from tlv320aic23 codec

Remove codec var from tlv320aic23_set_dai_sysclk, it is assigned to but never read.

Cc Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>
---
 sound/soc/codecs/tlv320aic23.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
sound/soc/codecs/tlv320aic23.c +0 -2
index 44308da..45395d0 100644
@@ -421,8 +421,6 @@ static int tlv320aic23_set_dai_fmt(struct snd_soc_dai *codec_dai,
 static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 				      int clk_id, unsigned int freq, int dir)
 {
-	struct snd_soc_codec *codec = codec_dai->codec;
-
 	switch (freq) {
 	case 12000000:
 		return 0;
Signature · 1 line
1.5.6.4
#3 lore raw

Re: [PATCH] Remove unused variable from tlv320aic23 codec

Quoted 2 lines · Richard A. Holden III

Remove codec var from tlv320aic23_set_dai_sysclk, it is assigned to but never read.

This does not apply - it looks like you've generated it against code from before commit 26df91c3 (ASoC: TLV320AIC23B Support more sample rates) from 5th November which rewrote all this code.

#4 lore raw

Re: [alsa-devel] [PATCH] Remove unused variable from tlv320aic23 codec

In reply to Richard A. Holden III

At Thu, 20 Nov 2008 11:03:23 -0700,

Quoted 6 lines · Richard A. Holden III

Remove codec var from tlv320aic23_set_dai_sysclk, it is assigned to but never read.

Quoted 8 lines
Cc Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
Cc Liam Girdwood <[email protected]>
Cc Mark Brown <[email protected]>
---
 sound/soc/codecs/tlv320aic23.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

This is already fixed in the upstream, but pretty differently.

Takashi

Quoted 21 lines
sound/soc/codecs/tlv320aic23.c +0 -2
index 44308da..45395d0 100644
@@ -421,8 +421,6 @@ static int tlv320aic23_set_dai_fmt(struct snd_soc_dai *codec_dai,
 static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 				      int clk_id, unsigned int freq, int dir)
 {
-	struct snd_soc_codec *codec = codec_dai->codec;
-
 	switch (freq) {
 	case 12000000:
 		return 0;
Signature · 6 lines
1.5.6.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#5 lore raw

Re: [PATCH] Remove unused variables from the cirrusfb driver

In reply to Richard A. Holden III

Hi Richard,

Quoted 3 lines · On Thu, 20 Nov 2008 11:03:22 -0700 "Richard A. Holden III"…

Remove i and s vars from cirrusfb_setup as they are not used anywhere in that function. This fixes 2 unused vars build warnings.

Thanks for the patch, but this is already fixed in mainline (commit ee11940f8e7a2f064af22d52180cb5f9643eef61 "cirrusfb: remove unused variables").

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#6 lore raw

Re: [PATCH] Remove unused variables from the cirrusfb driver

Quoted 16 lines · Stephen Rothwell

Hi Richard,

On Thu, 20 Nov 2008 11:03:22 -0700 "Richard A. Holden III" <[email protected]

Quoted 4 lines

wrote:

Remove i and s vars from cirrusfb_setup as they are not used anywhere in that function. This fixes 2 unused vars build warnings.

Thanks for the patch, but this is already fixed in mainline (commit ee11940f8e7a2f064af22d52180cb5f9643eef61 "cirrusfb: remove unused variables").

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/

Am I right in assuming you pulled mainline before this commit for next-20081120? I don't see the changelog in next and I'm getting the build warnings still, but I can recheck this in the next version of next.

-Richard Holden

#7 lore raw

Re: [PATCH] Remove unused variables from the cirrusfb driver

Hi Richard,

Quoted 5 lines · On Thu, 20 Nov 2008 23:12:42 -0700 Richard Holden <[email protected]> wrote:

Am I right in assuming you pulled mainline before this commit for next-20081120? I don't see the changelog in next and I'm getting the build warnings still, but I can recheck this in the next version of next.

Yes, I refetch all the trees before I begin building the tree each day. That patch went to Linus yesterday so it will be in today's linux-next when I release it.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/