diff mbox series

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

Message ID 20201221123008.9930-7-andriy.shevchenko@linux.intel.com
State Accepted
Commit c939e1ca5d952cad05f4aa14135cba2b1b1947e0
Delegated to: Tom Rini
Headers show
Series [v3,1/9] console: Introduce console_start() and console_stop() | expand

Commit Message

Andy Shevchenko Dec. 21, 2020, 12:30 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>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
v3: added tag
 common/iomux.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Tom Rini Jan. 16, 2021, 4:25 p.m. UTC | #1
On Mon, Dec 21, 2020 at 02:30:06PM +0200, Andy Shevchenko wrote:

> 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>

Applied to u-boot/master, thanks!
diff mbox series

Patch

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) {