Skip to contentSkip to conversation

phy: Fix off-by-one error when parsing DT PHY bindings

PATCH New Marek Vasut 2 participants 3 messages Aug 8, 2018 – Aug 9, 2018 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: Fix off-by-one error when parsing DT PHY bindings

The code fails to copy the last PHY phandle argument, so it is missing from the adjusted phandle args and the consumer cannot use it to determine what the PHY should do.

Cc Patrice Chotard <[email protected]>
---
 drivers/phy/phy-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-uclass.c +1 -1
index 6162395e75..a0ac30aa71 100644
@@ -64,7 +64,7 @@ int generic_phy_get_by_index(struct udevice *dev, int index,
 			return ret;
 
 		/* insert phy idx at first position into args array */
-		for (i = args.args_count; i > 1 ; i--)
+		for (i = args.args_count; i >= 1 ; i--)
 			args.args[i] = args.args[i - 1];
 
 		args.args_count++;
Signature · 1 line
2.16.2
#1 lore raw

PATCH 1/1 phy: Fix off-by-one error when parsing DT PHY bindings

Hi Marek

Quoted 16 lines · Marek Vasut

The code fails to copy the last PHY phandle argument, so it is missing from the adjusted phandle args and the consumer cannot use it to determine what the PHY should do.

Cc Patrice Chotard <[email protected]>
---
  drivers/phy/phy-uclass.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-uclass.c +0 -0
index 6162395e75..a0ac30aa71 100644

drivers/phy/phy-uclass.c int generic_phy_get_by_index(struct udevice *dev, int index, · line 70

Quoted 8 lines
drivers/phy/phy-uclass.c +1 -1
@@ -64,7 +64,7 @@ int generic_phy_get_by_index(struct udevice *dev, int index,
  			return ret;
 
  		/* insert phy idx at first position into args array */
-		for (i = args.args_count; i > 1 ; i--)
+		for (i = args.args_count; i >= 1 ; i--)
  			args.args[i] = args.args[i - 1];
 
  		args.args_count++;

Thanks

#2 lore raw

PATCH 1/1 phy: Fix off-by-one error when parsing DT PHY bindings

Quoted 25 lines · Patrice CHOTARD

Hi Marek

Quoted 22 lines · Marek Vasut

The code fails to copy the last PHY phandle argument, so it is missing from the adjusted phandle args and the consumer cannot use it to determine what the PHY should do.

Cc Patrice Chotard <[email protected]>
---
  drivers/phy/phy-uclass.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/phy-uclass.c +1 -1
index 6162395e75..a0ac30aa71 100644
@@ -64,7 +64,7 @@ int generic_phy_get_by_index(struct udevice *dev, int index,
  			return ret;
 
  		/* insert phy idx at first position into args array */
-		for (i = args.args_count; i > 1 ; i--)
+		for (i = args.args_count; i >= 1 ; i--)
  			args.args[i] = args.args[i - 1];
 
Quoted 4 lines

drivers/phy/phy-uclass.c int generic_phy_get_by_index(struct udevice *dev, int index, · line 70

Quoted 2 lines
drivers/phy/phy-uclass.c +0 -0
  		args.args_count++;

Who's picking this up ?

Signature · 2 lines
Best regards,
Marek Vasut