diff options
author | Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> | 2018-09-13 01:28:54 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-09-25 21:49:18 -0400 |
commit | 8bf207d242b603954d5338dabf31b8de01805677 (patch) | |
tree | 994ab9dccb614552323fdb98f523776ac3a55680 /drivers/ata/ahci.c | |
parent | 47cef9c80587e3ec8d3f3cbd546c0539c372a995 (diff) | |
download | u-boot-8bf207d242b603954d5338dabf31b8de01805677.zip u-boot-8bf207d242b603954d5338dabf31b8de01805677.tar.gz u-boot-8bf207d242b603954d5338dabf31b8de01805677.tar.bz2 |
ata: ahci: Loop over the actual number of ports, not the maximum
The loop in ahci_start_ports() is looping over the maximum number of
SCSI devices in the system, which can be larger than the amount of ports
a particular AHCI controller has. The extra looping isn't directly
harmful because the link_port_map bitmap won't have the bit set for a
nonexistent port, but it is wasteful. Replace the loop limit with the
port count of the AHCI controller instead.
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r-- | drivers/ata/ahci.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index c35912b..333f045 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -980,7 +980,7 @@ static int ahci_start_ports(struct ahci_uc_priv *uc_priv) linkmap = uc_priv->link_port_map; - for (i = 0; i < CONFIG_SYS_SCSI_MAX_SCSI_ID; i++) { + for (i = 0; i < uc_priv->n_ports; i++) { if (((linkmap >> i) & 0x01)) { if (ahci_port_start(uc_priv, (u8) i)) { printf("Can not start port %d\n", i); |