From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Fri, 18 Dec 2020 19:29:21 -0700 Subject: [PATCH v2 5/7] IOMUX: Refactor iomux_doenv() in order to increase readability In-Reply-To: <20201216231624.9724-5-andriy.shevchenko@linux.intel.com> References: <20201216231624.9724-1-andriy.shevchenko@linux.intel.com> <20201216231624.9724-5-andriy.shevchenko@linux.intel.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, 16 Dec 2020 at 16:16, 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 > --- > v2: no changes > common/iomux.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) Reviewed-by: Simon Glass > > diff --git a/common/iomux.c b/common/iomux.c > index cee5f266c86e..51557d028029 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) { event better: if (temp) > - 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 >