Commit b004223db7249d42db893df916457acecc22759c

Authored by Andrew Morton
Committed by Bartlomiej Zolnierkiewicz
1 parent 1dcfdf93f6

drivers/ide/legacy/hd.c: fix uninitialized var warning

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>

Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff

drivers/ide/legacy/hd.c
... ... @@ -421,11 +421,14 @@
421 421  
422 422 static inline int wait_DRQ(void)
423 423 {
424   - int retries = 100000, stat;
  424 + int retries;
  425 + int stat;
425 426  
426   - while (--retries > 0)
427   - if ((stat = inb_p(HD_STATUS)) & DRQ_STAT)
  427 + for (retries = 0; retries < 100000; retries++) {
  428 + stat = inb_p(HD_STATUS);
  429 + if (stat & DRQ_STAT)
428 430 return 0;
  431 + }
429 432 dump_status("wait_DRQ", stat);
430 433 return -1;
431 434 }