* [PATCH] quiet ide-cd warning
@ 2005-04-01 20:11 Matt Mackall
2005-04-01 23:46 ` Michael Tokarev
0 siblings, 1 reply; 3+ messages in thread
From: Matt Mackall @ 2005-04-01 20:11 UTC (permalink / raw)
To: linux-kernel, Andrew Morton
This shuts up a potential uninitialized variable warning.
Signed-off-by: Matt Mackall <mpm@selenic.com>
Index: af/drivers/ide/ide-cd.c
===================================================================
--- af.orig/drivers/ide/ide-cd.c 2005-04-01 11:17:37.000000000 -0800
+++ af/drivers/ide/ide-cd.c 2005-04-01 11:55:09.000000000 -0800
@@ -430,7 +430,7 @@ void cdrom_analyze_sense_data(ide_drive_
#if VERBOSE_IDE_CD_ERRORS
{
int i;
- const char *s;
+ const char *s = "bad sense key!";
char buf[80];
printk ("ATAPI device %s:\n", drive->name);
@@ -445,8 +445,6 @@ void cdrom_analyze_sense_data(ide_drive_
if (sense->sense_key < ARY_LEN(sense_key_texts))
s = sense_key_texts[sense->sense_key];
- else
- s = "bad sense key!";
printk("%s -- (Sense key=0x%02x)\n", s, sense->sense_key);
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] quiet ide-cd warning
2005-04-01 20:11 [PATCH] quiet ide-cd warning Matt Mackall
@ 2005-04-01 23:46 ` Michael Tokarev
2005-04-02 0:31 ` Matt Mackall
0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2005-04-01 23:46 UTC (permalink / raw)
To: Matt Mackall; +Cc: linux-kernel, Andrew Morton
Matt Mackall wrote:
> This shuts up a potential uninitialized variable warning.
Potential warning or potential uninitialized use?
The code was right before the change, and if the compiler
generates such a warning on it, it's the compiler who
should be fixed, not the code: it's obvious the variable
can't be used uninitialized here, and moving the things
around like that makes the code misleading and hard to
understand...
/mjt
> Signed-off-by: Matt Mackall <mpm@selenic.com>
>
> Index: af/drivers/ide/ide-cd.c
> ===================================================================
> --- af.orig/drivers/ide/ide-cd.c 2005-04-01 11:17:37.000000000 -0800
> +++ af/drivers/ide/ide-cd.c 2005-04-01 11:55:09.000000000 -0800
> @@ -430,7 +430,7 @@ void cdrom_analyze_sense_data(ide_drive_
> #if VERBOSE_IDE_CD_ERRORS
> {
> int i;
> - const char *s;
> + const char *s = "bad sense key!";
> char buf[80];
>
> printk ("ATAPI device %s:\n", drive->name);
> @@ -445,8 +445,6 @@ void cdrom_analyze_sense_data(ide_drive_
>
> if (sense->sense_key < ARY_LEN(sense_key_texts))
> s = sense_key_texts[sense->sense_key];
> - else
> - s = "bad sense key!";
>
> printk("%s -- (Sense key=0x%02x)\n", s, sense->sense_key);
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] quiet ide-cd warning
2005-04-01 23:46 ` Michael Tokarev
@ 2005-04-02 0:31 ` Matt Mackall
0 siblings, 0 replies; 3+ messages in thread
From: Matt Mackall @ 2005-04-02 0:31 UTC (permalink / raw)
To: Michael Tokarev; +Cc: linux-kernel, Andrew Morton
On Sat, Apr 02, 2005 at 03:46:53AM +0400, Michael Tokarev wrote:
> Matt Mackall wrote:
> >This shuts up a potential uninitialized variable warning.
>
> Potential warning or potential uninitialized use?
> The code was right before the change, and if the compiler
> generates such a warning on it, it's the compiler who
> should be fixed, not the code: it's obvious the variable
> can't be used uninitialized here, and moving the things
> around like that makes the code misleading and hard to
> understand...
It's a compiler problem.
With gcc 3.3.5:
drivers/ide/ide-cd.c: In function `cdrom_analyze_sense_data':
drivers/ide/ide-cd.c:433: warning: `s' might be used uninitialized in
this function
Looks like the compiler's being stupid about my earlier patch which
makes printk an inline (and it's the only thing in the tree to do so).
gcc-snapshot doesn't complain.
> /mjt
>
> >Signed-off-by: Matt Mackall <mpm@selenic.com>
> >
> >Index: af/drivers/ide/ide-cd.c
> >===================================================================
> >--- af.orig/drivers/ide/ide-cd.c 2005-04-01 11:17:37.000000000 -0800
> >+++ af/drivers/ide/ide-cd.c 2005-04-01 11:55:09.000000000 -0800
> >@@ -430,7 +430,7 @@ void cdrom_analyze_sense_data(ide_drive_
> > #if VERBOSE_IDE_CD_ERRORS
> > {
> > int i;
> >- const char *s;
> >+ const char *s = "bad sense key!";
> > char buf[80];
> >
> > printk ("ATAPI device %s:\n", drive->name);
> >@@ -445,8 +445,6 @@ void cdrom_analyze_sense_data(ide_drive_
> >
> > if (sense->sense_key < ARY_LEN(sense_key_texts))
> > s = sense_key_texts[sense->sense_key];
> >- else
> >- s = "bad sense key!";
> >
> > printk("%s -- (Sense key=0x%02x)\n", s, sense->sense_key);
> >
> >
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-04-02 0:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-01 20:11 [PATCH] quiet ide-cd warning Matt Mackall
2005-04-01 23:46 ` Michael Tokarev
2005-04-02 0:31 ` Matt Mackall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox