diff mbox series

[v1,3/4] IOMUX: Refactor iomux_doenv() in order to increase readability

Message ID 20201216180413.18887-3-andriy.shevchenko@linux.intel.com
State Superseded
Delegated to: Tom Rini
Headers show
Series [v1,1/4] IOMUX: Preserve console list if realloc() fails | expand

Commit Message

Andy Shevchenko Dec. 16, 2020, 6:04 p.m. UTC
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@linux.intel.com>
---
 common/iomux.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/common/iomux.c b/common/iomux.c
index 9fae124442c1..8a063563aa27 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) {