[PATCH v3 7/9] IOMUX: Refactor iomux_doenv() in order to increase readability

Andy Shevchenko andriy.shevchenko at linux.intel.com
Mon Dec 21 13:30:06 CET 2020


Refactor iomux_doenv() a bit in order to increase readability.
There is no change in code generation on x86.

Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
v3: added tag
 common/iomux.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/common/iomux.c b/common/iomux.c
index 7b7b063cfc6b..7991235d1197 100644
--- a/common/iomux.c
+++ b/common/iomux.c
@@ -45,15 +45,14 @@ int iomux_doenv(const int console, const char *arg)
 	i = 0;
 	temp = console_args;
 	for (;;) {
-		temp = strchr(temp, ',');
-		if (temp != NULL) {
-			i++;
-			temp++;
-			continue;
-		}
 		/* There's always one entry more than the number of commas. */
 		i++;
-		break;
+
+		temp = strchr(temp, ',');
+		if (temp == NULL)
+			break;
+
+		temp++;
 	}
 	start = (char **)malloc(i * sizeof(char *));
 	if (start == NULL) {
-- 
2.29.2



More information about the U-Boot mailing list