Re: [PATCH] fix amiga and atari floppy driver compile warning

From: Geert Uytterhoeven
Date: Thu Oct 28 2010 - 14:46:27 EST


On Thu, Oct 28, 2010 at 20:42, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote:
> Geert, my crosstool don't produce warning below. I guess this has to do
> something with compiler version.
>
> - Geert noticed following warning during compilation.
>
> Âdrivers/block/amiflop.c:1344: warning: ârqâ may be used uninitialized in
> Âthis function
> Âdrivers/block/ataflop.c:1402: warning: ârqâ may be used uninitialized in
> Âthis function
>
> - Initialize rq to NULL to fix the warning. If we can't find a suitable request
> Âto dispatch, this function should return NULL instead of a possibly garbage
> Âpointer.

Thanks, gcc version 4.1.2 20061115 now no longer gives a warning.

> - Cross compile tested only. Don't have hardware to test it.

Floppy hardware in bad state here :-(

> Reported-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Signed-off-by: Vivek Goyal <vgoyal@xxxxxxxxxx>
> ---
> Âdrivers/block/amiflop.c | Â Â2 +-
> Âdrivers/block/ataflop.c | Â Â2 +-
> Â2 files changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/drivers/block/amiflop.c
> ===================================================================
> --- linux-2.6.orig/drivers/block/amiflop.c   Â2010-10-28 14:32:25.000000000 -0400
> +++ linux-2.6/drivers/block/amiflop.c  2010-10-28 14:34:11.000000000 -0400
> @@ -1341,7 +1341,7 @@ static struct request *set_next_request(
> Â{
> Â Â Â Âstruct request_queue *q;
> Â Â Â Âint cnt = FD_MAX_UNITS;
> - Â Â Â struct request *rq;
> + Â Â Â struct request *rq = NULL;
>
> Â Â Â Â/* Find next queue we can dispatch from */
> Â Â Â Âfdc_queue = fdc_queue + 1;
> Index: linux-2.6/drivers/block/ataflop.c
> ===================================================================
> --- linux-2.6.orig/drivers/block/ataflop.c   Â2010-10-28 14:31:21.000000000 -0400
> +++ linux-2.6/drivers/block/ataflop.c  2010-10-28 14:33:58.000000000 -0400
> @@ -1399,7 +1399,7 @@ static struct request *set_next_request(
> Â{
> Â Â Â Âstruct request_queue *q;
> Â Â Â Âint old_pos = fdc_queue;
> - Â Â Â struct request *rq;
> + Â Â Â struct request *rq = NULL;
>
> Â Â Â Âdo {
> Â Â Â Â Â Â Â Âq = unit[fdc_queue].disk->queue;
>

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/