linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix amiga and atari floppy driver compile warning
@ 2010-10-28 18:42 Vivek Goyal
  2010-10-28 18:46 ` Geert Uytterhoeven
  2010-11-15 15:27 ` Vivek Goyal
  0 siblings, 2 replies; 4+ messages in thread
From: Vivek Goyal @ 2010-10-28 18:42 UTC (permalink / raw)
  To: Jens Axboe, linux kernel mailing list, Geert Uytterhoeven; +Cc: linux-m68k, hch

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.

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

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
 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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix amiga and atari floppy driver compile warning
  2010-10-28 18:42 [PATCH] fix amiga and atari floppy driver compile warning Vivek Goyal
@ 2010-10-28 18:46 ` Geert Uytterhoeven
  2010-11-15 15:27 ` Vivek Goyal
  1 sibling, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2010-10-28 18:46 UTC (permalink / raw)
  To: Vivek Goyal; +Cc: Jens Axboe, linux kernel mailing list, linux-m68k, hch

On Thu, Oct 28, 2010 at 20:42, Vivek Goyal <vgoyal@redhat.com> 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@linux-m68k.org>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
>  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@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix amiga and atari floppy driver compile warning
  2010-10-28 18:42 [PATCH] fix amiga and atari floppy driver compile warning Vivek Goyal
  2010-10-28 18:46 ` Geert Uytterhoeven
@ 2010-11-15 15:27 ` Vivek Goyal
  2010-11-15 18:33   ` Jens Axboe
  1 sibling, 1 reply; 4+ messages in thread
From: Vivek Goyal @ 2010-11-15 15:27 UTC (permalink / raw)
  To: Jens Axboe, linux kernel mailing list, Geert Uytterhoeven; +Cc: linux-m68k, hch

On Thu, Oct 28, 2010 at 02:42:23PM -0400, Vivek Goyal 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.
> 
> - Cross compile tested only. Don't have hardware to test it.
> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>

Hi Jens,

Do you have any concerns about this patch? If not, can you please apply
it.

Thanks
Vivek

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix amiga and atari floppy driver compile warning
  2010-11-15 15:27 ` Vivek Goyal
@ 2010-11-15 18:33   ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2010-11-15 18:33 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: linux kernel mailing list, Geert Uytterhoeven, linux-m68k, hch

On 2010-11-15 16:27, Vivek Goyal wrote:
> On Thu, Oct 28, 2010 at 02:42:23PM -0400, Vivek Goyal 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.
>>
>> - Cross compile tested only. Don't have hardware to test it.
>>
>> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> 
> Hi Jens,
> 
> Do you have any concerns about this patch? If not, can you please apply
> it.

No, it's straight forward just got missed in travel. Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-15 18:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 18:42 [PATCH] fix amiga and atari floppy driver compile warning Vivek Goyal
2010-10-28 18:46 ` Geert Uytterhoeven
2010-11-15 15:27 ` Vivek Goyal
2010-11-15 18:33   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).