]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] fix return value for idedisk_*_max_address_* functions
authorBartlomiej Zolnierkiewicz <b.zolnierkiewicz@elka.pw.edu.pl>
Thu, 7 Aug 2003 03:16:37 +0000 (20:16 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 7 Aug 2003 03:16:37 +0000 (20:16 -0700)
From Andries.Brouwer@cwi.nl:

- these functions should return 0 not 1 on error

drivers/ide/ide-disk.c

index 2fecccdf9facc604f570050cb60acaf2cd2ba60e..55435d039cc762c42f96cc690891f24e463a9bb8 100644 (file)
@@ -964,8 +964,8 @@ static unsigned long idedisk_read_native_max_address(ide_drive_t *drive)
                     | ((args.tfRegister[  IDE_HCYL_OFFSET]       ) << 16)
                     | ((args.tfRegister[  IDE_LCYL_OFFSET]       ) <<  8)
                     | ((args.tfRegister[IDE_SECTOR_OFFSET]       ));
+               addr++; /* since the return value is (maxlba - 1), we add 1 */
        }
-       addr++; /* since the return value is (maxlba - 1), we add 1 */
        return addr;
 }
 
@@ -992,8 +992,8 @@ static unsigned long long idedisk_read_native_max_address_ext(ide_drive_t *drive
                           ((args.tfRegister[IDE_LCYL_OFFSET])<<8) |
                            (args.tfRegister[IDE_SECTOR_OFFSET]);
                addr = ((__u64)high << 24) | low;
+               addr++; /* since the return value is (maxlba - 1), we add 1 */
        }
-       addr++; /* since the return value is (maxlba - 1), we add 1 */
        return addr;
 }
 
@@ -1024,8 +1024,8 @@ static unsigned long idedisk_set_max_address(ide_drive_t *drive, unsigned long a
                         | ((args.tfRegister[  IDE_HCYL_OFFSET]       ) << 16)
                         | ((args.tfRegister[  IDE_LCYL_OFFSET]       ) <<  8)
                         | ((args.tfRegister[IDE_SECTOR_OFFSET]       ));
+               addr_set++;
        }
-       addr_set++;
        return addr_set;
 }
 
@@ -1059,6 +1059,7 @@ static unsigned long long idedisk_set_max_address_ext(ide_drive_t *drive, unsign
                           ((args.tfRegister[IDE_LCYL_OFFSET])<<8) |
                            (args.tfRegister[IDE_SECTOR_OFFSET]);
                addr_set = ((__u64)high << 24) | low;
+               addr_set++;
        }
        return addr_set;
 }