drivers/ide/legacy/hd.c: fix uninitialized var warning
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 6 Feb 2008 01:57:49 +0000 (02:57 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Wed, 6 Feb 2008 01:57:49 +0000 (02:57 +0100)
drivers/ide/legacy/hd.c: In function 'hd_request':
drivers/ide/legacy/hd.c:424: warning: 'stat' may be used uninitialized in this function

gcc is being stupid.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/legacy/hd.c

index 8e05d88e81babd0e74560821e80065dfa18e79d7..0b0d867319278af5e652d1310f887f0dafc915fa 100644 (file)
@@ -421,11 +421,14 @@ static void bad_rw_intr(void)
 
 static inline int wait_DRQ(void)
 {
-       int retries = 100000, stat;
+       int retries;
+       int stat;
 
-       while (--retries > 0)
-               if ((stat = inb_p(HD_STATUS)) & DRQ_STAT)
+       for (retries = 0; retries < 100000; retries++) {
+               stat = inb_p(HD_STATUS);
+               if (stat & DRQ_STAT)
                        return 0;
+       }
        dump_status("wait_DRQ", stat);
        return -1;
 }