From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suneel Garapati Date: Tue, 29 Oct 2019 14:08:07 -0700 Subject: [U-Boot] [RFC PATCH 15/29] drivers: ata: ahci: update max id if it is more than available ports In-Reply-To: <20191029210821.1954-1-suneelglinux@gmail.com> References: <20191029210821.1954-1-suneelglinux@gmail.com> Message-ID: <20191029210821.1954-16-suneelglinux@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Suneel Garapati After check for maximum between max id and available ports, also check if available port count is less than max id and update. Signed-off-by: Suneel Garapati --- drivers/ata/ahci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 21a89eba5a..ca075b58bc 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1177,6 +1177,9 @@ int ahci_probe_scsi(struct udevice *ahci_dev, ulong base) */ uc_plat->max_id = max_t(unsigned long, uc_priv->n_ports, uc_plat->max_id); + /* If port count is less than max_id, update max_id */ + if (uc_priv->n_ports < uc_plat->max_id) + uc_plat->max_id = uc_priv->n_ports; return 0; } -- 2.23.0