Skip to content

Commit

Permalink
Fix cache indexing of ata port (#96)
Browse files Browse the repository at this point in the history
Ata port number is 1-based indexing. Need to minus 1 to fit 0-based cache array index.
  • Loading branch information
r08ertliu authored May 26, 2022
1 parent 44eba13 commit 6e2b90d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/amd_sgpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static struct cache_entry *_get_cache(struct amd_drive *drive)
* cache_entry[n] => drive (4*n) to drive (4*n + 3)
*/

index = (drive->ata_port / 4);
index = ((drive->ata_port - 1) / 4);

return &sgpio_cache[index];
}
Expand Down

0 comments on commit 6e2b90d

Please sign in to comment.