2008-11-20 17:01:45

by Richard Holden

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Richard A. Holden III <[email protected]>
---
arch/x86/kernel/cpu/mtrr/main.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index c091d06..b751e3a 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -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",
--
1.5.6.4


2008-11-20 17:02:01

by Richard Holden

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Richard A. Holden III <[email protected]>
---
drivers/video/cirrusfb.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 8a87602..a2aa6dd 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -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");

--
1.5.6.4

2008-11-20 17:02:30

by Richard Holden

[permalink] [raw]
Subject: [PATCH] Remove unused variable from tlv320aic23 codec

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

Signed-off-by: Richard A. Holden III <[email protected]>

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

diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index 44308da..45395d0 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -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;
--
1.5.6.4

2008-11-20 18:56:40

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] Remove unused variable from tlv320aic23 codec

On Thu, Nov 20, 2008 at 11:03:23AM -0700, Richard A. Holden III wrote:

> 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.

2008-11-20 23:34:33

by Stephen Rothwell

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

Hi Richard,

On Thu, 20 Nov 2008 11:03:22 -0700 "Richard A. Holden III" <[email protected]> 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").

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (488.00 B)
(No filename) (197.00 B)
Download all attachments

2008-11-21 06:40:57

by Stephen Rothwell

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

Hi Richard,

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.

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (584.00 B)
(No filename) (197.00 B)
Download all attachments

2008-11-24 13:24:38

by Takashi Iwai

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

At Thu, 20 Nov 2008 11:03:23 -0700,
Richard A. Holden III wrote:
>
> Remove codec var from tlv320aic23_set_dai_sysclk, it is assigned to
> but never read.
>
> Signed-off-by: Richard A. Holden III <[email protected]>
>
> Cc: Jaroslav Kysela <[email protected]>
> Cc: Takashi Iwai <[email protected]>
> Cc: Liam Girdwood <[email protected]>
> Cc: Mark Brown <[email protected]>
> Cc: [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

> diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
> index 44308da..45395d0 100644
> --- a/sound/soc/codecs/tlv320aic23.c
> +++ b/sound/soc/codecs/tlv320aic23.c
> @@ -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;
> --
> 1.5.6.4
>
> _______________________________________________
> Alsa-devel mailing list
> [email protected]
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>

2008-11-21 06:12:58

by Richard Holden

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


On Nov 20, 2008, at 4:34 PM, Stephen Rothwell wrote:

> Hi Richard,
>
> On Thu, 20 Nov 2008 11:03:22 -0700 "Richard A. Holden III" <[email protected]
> > 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").
>
> --
> 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