summaryrefslogtreecommitdiff
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 21:39:36 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 21:39:36 +0200
commit35c137531245118962eb40a550661afe317bec03 (patch)
tree5fa3030baf4fad7a451d3ba991d57b5641a3a094 /drivers/ide/ide-disk.c
parent1ea1031cf92b8b8bfbe796d8e8d38b68300475d2 (diff)
ide-disk: set_addressing() fixes
* Return -EIO if arg > 0 and LBA48 is unsupported. * No need to reset ->addressing. * Make ->addressing a single bit flag. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r--drivers/ide/ide-disk.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 01846f244b40..65c499aab664 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -686,14 +686,13 @@ static int set_addressing(ide_drive_t *drive, int arg)
if (arg < 0 || arg > 2)
return -EINVAL;
- drive->addressing = 0;
-
- if (drive->hwif->host_flags & IDE_HFLAG_NO_LBA48)
- return 0;
-
- if (ata_id_lba48_enabled(drive->id) == 0)
+ if (arg && ((drive->hwif->host_flags & IDE_HFLAG_NO_LBA48) ||
+ ata_id_lba48_enabled(drive->id) == 0))
return -EIO;
+ if (arg == 2)
+ arg = 0;
+
drive->addressing = arg;
return 0;