diff mbox series

[U-Boot,RFC,15/29] drivers: ata: ahci: update max id if it is more than available ports

Message ID 20191029210821.1954-16-suneelglinux@gmail.com
State RFC
Delegated to: Tom Rini
Headers show
Series arm: Introduce Marvell/Cavium OcteonTX | expand

Commit Message

Suneel Garapati Oct. 29, 2019, 9:08 p.m. UTC
From: Suneel Garapati <sgarapati@marvell.com>

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 <sgarapati@marvell.com>
---
 drivers/ata/ahci.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Simon Glass Nov. 20, 2019, 3 a.m. UTC | #1
Hi Suneel,

On Tue, 29 Oct 2019 at 14:08, Suneel Garapati <suneelglinux@gmail.com> wrote:
>
> From: Suneel Garapati <sgarapati@marvell.com>
>
> 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 <sgarapati@marvell.com>
> ---
>  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;

What is the actually change with this code? It looks like it does the
same thinas the old code?

>
>         return 0;
>  }
> --
> 2.23.0
>

Regards,
Simon
diff mbox series

Patch

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;
 }