ata: ahci: Loop over the actual number of ports, not the maximum
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Wed, 12 Sep 2018 22:28:54 +0000 (01:28 +0300)
committerTom Rini <trini@konsulko.com>
Wed, 26 Sep 2018 01:49:18 +0000 (21:49 -0400)
commit8bf207d242b603954d5338dabf31b8de01805677
tree994ab9dccb614552323fdb98f523776ac3a55680
parent47cef9c80587e3ec8d3f3cbd546c0539c372a995
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>
drivers/ata/ahci.c