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>
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 01846f2..65c499a 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -686,14 +686,13 @@
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;