diff mbox

[U-Boot] common/cli_hush.c: remove unnecessary double braces

Message ID 1402439327-12031-1-git-send-email-jeroen@myspectrum.nl
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Jeroen Hofstee June 10, 2014, 10:28 p.m. UTC
Clang interpretes an if condition like  "if ((a = b) == NULL)
as it tries to assign a value in a statement. Hence if you do
"if ((something)) it warns you that you might be confused.
Hence drop the double braces for plane if statements.

Simon Glass <sjg@chromium.org>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
 common/cli_hush.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tom Rini June 11, 2014, 10:20 p.m. UTC | #1
On Wed, Jun 11, 2014 at 12:28:47AM +0200, Jeroen Hofstee wrote:

> Clang interpretes an if condition like  "if ((a = b) == NULL)
> as it tries to assign a value in a statement. Hence if you do
> "if ((something)) it warns you that you might be confused.
> Hence drop the double braces for plane if statements.
> 
> Simon Glass <sjg@chromium.org>
> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>

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

Patch

diff --git a/common/cli_hush.c b/common/cli_hush.c
index e0c436f..38da5a0 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -1840,7 +1840,7 @@  static int run_list_real(struct pipe *pi)
 		if (rmode == RES_DO) {
 			if (!flag_rep) continue;
 		}
-		if ((rmode == RES_DONE)) {
+		if (rmode == RES_DONE) {
 			if (flag_rep) {
 				flag_restore = 1;
 			} else {
@@ -3569,7 +3569,7 @@  static char **make_list_in(char **inp, char *name)
 		p3 = insert_var_value(inp[i]);
 		p1 = p3;
 		while (*p1) {
-			if ((*p1 == ' ')) {
+			if (*p1 == ' ') {
 				p1++;
 				continue;
 			}