diff mbox series

ata: libahci: use ahci_nr_ports() if port_map > ahci_nr_ports()

Message ID 20201119100540.3520589-1-lherbolt@redhat.com
State New
Headers show
Series ata: libahci: use ahci_nr_ports() if port_map > ahci_nr_ports() | expand

Commit Message

Lukas Herbolt Nov. 19, 2020, 10:05 a.m. UTC
While we report use of nr_port value, we set port_map to zero
which later leads to marking all the ports reported by ahci_nr_ports()
as DUMMY.

Signed-off-by: Lukas Herbolt <lherbolt@redhat.com>
---
 drivers/ata/libahci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index ea5bf5f4cbed..fe416b6542b2 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -522,7 +522,8 @@  void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
 			dev_warn(dev,
 				 "implemented port map (0x%x) contains more ports than nr_ports (%u), using nr_ports\n",
 				 port_map, ahci_nr_ports(cap));
-			port_map = 0;
+			port_map = (1 << ahci_nr_ports(cap)) - 1;
+			hpriv->saved_port_map = port_map;
 		}
 	}