Skip to contentSkip to conversation

net: fix phy_string_for_interface

PATCH In review Tim Harvey 5 participants 5 messages May 10, 2022 – May 23, 2022

lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 net: fix phy_string_for_interface

commit ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA") broke the phy_string_for_interface function. Fix it.

Fixes ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA")

Cc Marek Behún <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Ramon Fried <[email protected]>
Cc Vladimir Oltean <[email protected]>
---
 include/phy_interface.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/phy_interface.h +1 -1
index ce3b5004ec22..fed3357b9a26 100644
@@ -85,7 +85,7 @@ static const char * const backplane_mode_strings[] = {
 static inline const char *phy_string_for_interface(phy_interface_t i)
 {
 	/* Default to unknown */
-	if (i > PHY_INTERFACE_MODE_NA)
+	if (i >= PHY_INTERFACE_MODE_MAX)
 		i = PHY_INTERFACE_MODE_NA;
 
 	return phy_interface_strings[i];
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Tim Harvey

commit ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA") broke the phy_string_for_interface function. Fix it.

Fixes ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA")

Cc Marek Behún <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Ramon Fried <[email protected]>
Cc Vladimir Oltean <[email protected]>

Thanks,
Stefan

Quoted 9 lines
---
  include/phy_interface.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/phy_interface.h +0 -0
index ce3b5004ec22..fed3357b9a26 100644

include/phy_interface.h static const char * const backplane_mode_strings[] = { · line 91

Quoted 8 lines
include/phy_interface.h +1 -1
@@ -85,7 +85,7 @@ static const char * const backplane_mode_strings[] = {
  static inline const char *phy_string_for_interface(phy_interface_t i)
  {
  	/* Default to unknown */
-	if (i > PHY_INTERFACE_MODE_NA)
+	if (i >= PHY_INTERFACE_MODE_MAX)
  		i = PHY_INTERFACE_MODE_NA;
 
  	return phy_interface_strings[i];

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Reviewed-by on v1 1/1
#2 lore raw
In reply to Tim Harvey
Quoted 19 lines · On Tue, 10 May 2022 15:49:10 -0700 Tim Harvey <[email protected]> wrote:

commit ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA") broke the phy_string_for_interface function. Fix it.

Fixes ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA")

Cc Marek Behún <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Ramon Fried <[email protected]>
Cc Vladimir Oltean <[email protected]>
---
 include/phy_interface.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/phy_interface.h +0 -0
index ce3b5004ec22..fed3357b9a26 100644

include/phy_interface.h static const char * const backplane_mode_strings[] = { · line 91

Quoted 8 lines
include/phy_interface.h +1 -1
@@ -85,7 +85,7 @@ static const char * const backplane_mode_strings[] = {
 static inline const char *phy_string_for_interface(phy_interface_t i)
 {
 	/* Default to unknown */
-	if (i > PHY_INTERFACE_MODE_NA)
+	if (i >= PHY_INTERFACE_MODE_MAX)
 		i = PHY_INTERFACE_MODE_NA;
 
 	return phy_interface_strings[i];

Yikes.

Reviewed-by
#3 lore raw
Quoted 30 lines · Marek Behún
Quoted 26 lines · On Tue, 10 May 2022 15:49:10 -0700 Tim Harvey <[email protected]> wrote:

commit ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA") broke the phy_string_for_interface function. Fix it.

Fixes ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA")

Cc Marek Behún <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Ramon Fried <[email protected]>
Cc Vladimir Oltean <[email protected]>
---
 include/phy_interface.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/phy_interface.h +1 -1
index ce3b5004ec22..fed3357b9a26 100644
@@ -85,7 +85,7 @@ static const char * const backplane_mode_strings[] = {
 static inline const char *phy_string_for_interface(phy_interface_t i)
 {
      /* Default to unknown */
-     if (i > PHY_INTERFACE_MODE_NA)
+     if (i >= PHY_INTERFACE_MODE_MAX)
              i = PHY_INTERFACE_MODE_NA;
 
Quoted 5 lines

include/phy_interface.h static const char * const backplane_mode_strings[] = { · line 91

Quoted 1 line
include/phy_interface.h +0 -0
      return phy_interface_strings[i];

Yikes.

#4 lore raw
In reply to Tim Harvey
Quoted 5 lines · Tim Harvey

commit ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA") broke the phy_string_for_interface function. Fix it.

Fixes ffb0f6f488b9 ("treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA")

Quoted 8 lines

Applied to u-boot/master, thanks!

Signature · 1 line
Tom