public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alessandro Rubini <rubini-list@gnudd.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd_i2c: bugfix: add missing brace
Date: Fri, 17 Jul 2009 14:42:11 +0200	[thread overview]
Message-ID: <20090717124211.GA762@mail.gnudd.com> (raw)

From: Alessandro Rubini <rubini-list@gnudd.com>

The sub-command parser missed a brace, so "return 0;" is always
taken and no error message is diplayed if you say "i2c scan"
instead of "i2c probe", for example.

Proper brace is added. Also, a misleading and unneeded else
is removed.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com.it>
---
 common/cmd_i2c.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
index ae26845..8f0fc9e 100644
--- a/common/cmd_i2c.c
+++ b/common/cmd_i2c.c
@@ -1282,17 +1282,17 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 		return do_i2c_crc(cmdtp, flag, argc, argv);
 	if (!strncmp(argv[0], "pr", 2))
 		return do_i2c_probe(cmdtp, flag, argc, argv);
-	if (!strncmp(argv[0], "re", 2))
+	if (!strncmp(argv[0], "re", 2)) {
 		i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 		return 0;
+	}
 	if (!strncmp(argv[0], "lo", 2))
 		return do_i2c_loop(cmdtp, flag, argc, argv);
 #if defined(CONFIG_CMD_SDRAM)
 	if (!strncmp(argv[0], "sd", 2))
 		return do_sdram(cmdtp, flag, argc, argv);
 #endif
-	else
-		cmd_usage(cmdtp);
+	cmd_usage(cmdtp);
 	return 0;
 }
 
-- 
1.6.0.2

             reply	other threads:[~2009-07-17 12:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17 12:42 Alessandro Rubini [this message]
2009-07-18  8:28 ` [U-Boot] [PATCH] cmd_i2c: bugfix: add missing brace Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090717124211.GA762@mail.gnudd.com \
    --to=rubini-list@gnudd.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox