summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-06-29 10:07:25 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-06-29 10:07:25 -0400
commit025841cfb5a8f5a48fa32fa71cf447f045d64e29 (patch)
tree3166b982034b19285835ad9349db252d77214960
parentf3de4729ce7bd5c36478c3c30784f4f1dc6a80ed (diff)
downloadrockbox-025841cfb5a8f5a48fa32fa71cf447f045d64e29.tar.gz
rockbox-025841cfb5a8f5a48fa32fa71cf447f045d64e29.zip
ata: Use consistent error values for all invocations of set_features()
set_features() returns an error between -1 and -39, so make sure every caller adds -60 to that so no matter where an error is printed the value is consistent. Change-Id: Ic81108ee70a2cb5ff7ea2445f086420fe850d07e
-rw-r--r--firmware/drivers/ata.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index b245cbc09e..d82fb173cc 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -962,8 +962,8 @@ static int perform_soft_reset(void)
962 if (identify()) 962 if (identify())
963 return -5; 963 return -5;
964 964
965 if (set_features()) 965 if ((ret = set_features()))
966 return -2; 966 return -60 + ret;
967 967
968 if (set_multiple_mode(multisectors)) 968 if (set_multiple_mode(multisectors))
969 return -3; 969 return -3;
@@ -1013,7 +1013,7 @@ static int ata_power_on(void)
1013 1013
1014 rc = set_features(); 1014 rc = set_features();
1015 if (rc) 1015 if (rc)
1016 return rc * 10 - 2; 1016 return -60 + rc;
1017 1017
1018 if (set_multiple_mode(multisectors)) 1018 if (set_multiple_mode(multisectors))
1019 return -3; 1019 return -3;
@@ -1284,7 +1284,7 @@ int STORAGE_INIT_ATTR ata_init(void)
1284 goto error; 1284 goto error;
1285 } 1285 }
1286 1286
1287 rc = set_features(); 1287 rc = set_features(); // rror codes are between -1 and -49
1288 if (rc) { 1288 if (rc) {
1289 rc = -60 + rc; 1289 rc = -60 + rc;
1290 goto error; 1290 goto error;
@@ -1321,7 +1321,7 @@ int STORAGE_INIT_ATTR ata_init(void)
1321 } 1321 }
1322 rc = set_multiple_mode(multisectors); 1322 rc = set_multiple_mode(multisectors);
1323 if (rc) 1323 if (rc)
1324 rc = -70 + rc; 1324 rc = -100 + rc;
1325 1325
1326error: 1326error:
1327 mutex_unlock(&ata_mtx); 1327 mutex_unlock(&ata_mtx);