IOMUX: Refactor iomux_doenv() in order to increase readability
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 21 Dec 2020 12:30:06 +0000 (14:30 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 15 Jan 2021 19:38:00 +0000 (14:38 -0500)
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>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/iomux.c

index 7b7b063..7991235 100644 (file)
@@ -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) {