Skip to contentSkip to conversation

net: phy: micrel: Fix error handling

PATCH In review Marek Vasut 3 participants 3 messages Nov 14, 2016 – Dec 1, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: micrel: Fix error handling

Fix the following error, the $ret variable handling must be part of the loop, while due to the missing parenthesis it was not.

drivers/net/phy/micrel.c: In function ?ksz9021_of_config?:
drivers/net/phy/micrel.c:303:2: warning: this ?for? clause does not guard... [-Wmisleading-indentation]
for (i = 0; i < ARRAY_SIZE(ofcfg); i++)
^~~
drivers/net/phy/micrel.c:305:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ?for?
if (ret)
^~
drivers/net/phy/micrel.c: In function ?ksz9031_of_config?:
drivers/net/phy/micrel.c:411:2: warning: this ?for? clause does not guard... [-Wmisleading-indentation]
for (i = 0; i < ARRAY_SIZE(ofcfg); i++)
^~~
drivers/net/phy/micrel.c:413:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ?for?
if (ret)
^~

Cc Joe Hershberger <[email protected]>
---
 drivers/net/phy/micrel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/phy/micrel.c +4 -2
index 28a1401..7163fa2 100644
@@ -300,10 +300,11 @@ static int ksz9021_of_config(struct phy_device *phydev)
 	};
 	int i, ret = 0;
 
-	for (i = 0; i < ARRAY_SIZE(ofcfg); i++)
+	for (i = 0; i < ARRAY_SIZE(ofcfg); i++) {
 		ret = ksz90x1_of_config_group(phydev, &(ofcfg[i]));
 		if (ret)
 			return ret;
+	}
 
 	return 0;
 }
@@ -408,10 +409,11 @@ static int ksz9031_of_config(struct phy_device *phydev)
 	};
 	int i, ret = 0;
 
-	for (i = 0; i < ARRAY_SIZE(ofcfg); i++)
+	for (i = 0; i < ARRAY_SIZE(ofcfg); i++) {
 		ret = ksz90x1_of_config_group(phydev, &(ofcfg[i]));
 		if (ret)
 			return ret;
+	}
 
 	return 0;
 }
Signature · 1 line
2.10.2
#1 lore raw

PATCH 1/1 net: phy: micrel: Fix error handling

Quoted 19 lines · Marek Vasut

Fix the following error, the $ret variable handling must be part of the loop, while due to the missing parenthesis it was not.

drivers/net/phy/micrel.c: In function ?ksz9021_of_config?:
drivers/net/phy/micrel.c:303:2: warning: this ?for? clause does not guard... [-Wmisleading-indentation]
for (i = 0; i < ARRAY_SIZE(ofcfg); i++)
^~~
drivers/net/phy/micrel.c:305:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ?for?
if (ret)
^~
drivers/net/phy/micrel.c: In function ?ksz9031_of_config?:
drivers/net/phy/micrel.c:411:2: warning: this ?for? clause does not guard... [-Wmisleading-indentation]
for (i = 0; i < ARRAY_SIZE(ofcfg); i++)
^~~
drivers/net/phy/micrel.c:413:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ?for?
if (ret)
^~

Quoted 2 lines
Cc Joe Hershberger <[email protected]>
Quoted 9 lines
---
 drivers/net/phy/micrel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/phy/micrel.c +0 -0
index 28a1401..7163fa2 100644

drivers/net/phy/micrel.c static int ksz9021_of_config(struct phy_device *phydev) · line 307

Quoted 9 lines
drivers/net/phy/micrel.c +2 -1
@@ -300,10 +300,11 @@ static int ksz9021_of_config(struct phy_device *phydev)
        };
        int i, ret = 0;
 
-       for (i = 0; i < ARRAY_SIZE(ofcfg); i++)
+       for (i = 0; i < ARRAY_SIZE(ofcfg); i++) {
                ret = ksz90x1_of_config_group(phydev, &(ofcfg[i]));
                if (ret)
                        return ret;
+       }

Yikes! Nice catch. :/

Quoted 22 lines
drivers/net/phy/micrel.c +2 -2
        return 0;
 }
@@ -408,10 +409,11 @@ static int ksz9031_of_config(struct phy_device *phydev)
        };
        int i, ret = 0;
 
-       for (i = 0; i < ARRAY_SIZE(ofcfg); i++)
+       for (i = 0; i < ARRAY_SIZE(ofcfg); i++) {
                ret = ksz90x1_of_config_group(phydev, &(ofcfg[i]));
                if (ret)
                        return ret;
+       }
 
        return 0;
 }
--

2.10.2

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot