Skip to contentSkip to conversation

fix amiga and atari floppy driver compile warning

PATCH In review Vivek Goyal 3 participants 4 messages Oct 28, 2010 – Nov 15, 2010 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix amiga and atari floppy driver compile warning

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.

---
 drivers/block/amiflop.c |    2 +-
 drivers/block/ataflop.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/block/amiflop.c +1 -1
Index: linux-2.6/drivers/block/amiflop.c
===================================================================
@@ -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;
drivers/block/ataflop.c +1 -1
Index: linux-2.6/drivers/block/ataflop.c
===================================================================
@@ -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;
#1 lore raw
Quoted 5 lines · Vivek Goyal

Geert, my crosstool don't produce warning below. I guess this has to do something with compiler version.

- Geert noticed following warning during compilation.

Quoted 8 lines

 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.

Quoted 1 line

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

Floppy hardware in bad state here :-(

Quoted 26 lines

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

drivers/block/amiflop.c   2010-10-28 14:34:11.000000000 -0400 renamed from drivers/block/amiflop.c      2010-10-28 14:32:25.000000000 -0400 +1 -1
@@ -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
===================================================================

drivers/block/ataflop.c   2010-10-28 14:33:58.000000000 -0400 static struct request *set_next_request( · line 1405

Quoted 8 lines
drivers/block/ataflop.c   2010-10-28 14:33:58.000000000 -0400 renamed from drivers/block/ataflop.c      2010-10-28 14:31:21.000000000 -0400 +1 -1
@@ -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 -- [email protected]

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

#2 lore raw
In reply to Vivek Goyal
Quoted 10 lines · Vivek Goyal

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

Quoted 8 lines

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

Hi Jens,

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

Thanks
Vivek

Quoted 31 lines
---
 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
===================================================================

drivers/block/amiflop.c +1 -1
@@ -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
===================================================================

drivers/block/ataflop.c +1 -1
@@ -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;
#3 lore raw
Quoted 17 lines · Vivek Goyal
Quoted 16 lines · Vivek Goyal

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.

Quoted 7 lines
Quoted 2 lines

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.

Signature · 1 line
Jens Axboe