From patchwork Tue Aug 16 02:42:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 110125 X-Patchwork-Delegate: s-paulraj@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 0F72CB6F77 for ; Tue, 16 Aug 2011 12:43:46 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DECBB2808D; Tue, 16 Aug 2011 04:43:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PhvyRX1ZaowQ; Tue, 16 Aug 2011 04:43:43 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2524F28084; Tue, 16 Aug 2011 04:43:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F081028084 for ; Tue, 16 Aug 2011 04:43:39 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BJMTi1wRiDJG for ; Tue, 16 Aug 2011 04:43:39 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gx0-f172.google.com (mail-gx0-f172.google.com [209.85.161.172]) by theia.denx.de (Postfix) with ESMTPS id 3C49B28083 for ; Tue, 16 Aug 2011 04:43:36 +0200 (CEST) Received: by gxk19 with SMTP id 19so3321799gxk.3 for ; Mon, 15 Aug 2011 19:43:35 -0700 (PDT) Received: by 10.91.17.29 with SMTP id u29mr4611878agi.152.1313462614858; Mon, 15 Aug 2011 19:43:34 -0700 (PDT) Received: from localhost.localdomain (ip65-46-142-190.z142-46-65.customer.algx.net [65.46.142.190]) by mx.google.com with ESMTPS id t11sm2208874and.3.2011.08.15.19.42.53 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Aug 2011 19:43:34 -0700 (PDT) From: Joel A Fernandes To: u-boot@lists.denx.de Date: Mon, 15 Aug 2011 21:42:01 -0500 Message-Id: <1313462527-3876-1-git-send-email-agnel.joel@gmail.com> X-Mailer: git-send-email 1.7.1 Cc: Koen Kooi , Syed Mohammed Khasim , k-kooi@ti.com, jdk@ti.com Subject: [U-Boot] [PATCH 1/7] Corrected LED name match finding avoiding extraneous Usage printouts X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Jason Kridner Signed-off-by: Jason Kridner Signed-off-by: Koen Kooi Signed-off-by: Joel A Fernandes --- common/cmd_led.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/cmd_led.c b/common/cmd_led.c index c53195f..8b46848 100644 --- a/common/cmd_led.c +++ b/common/cmd_led.c @@ -83,7 +83,7 @@ int str_onoff (char *var) int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - int state, i; + int state, i, match = 0; /* Validate arguments */ if ((argc != 3)) { @@ -98,6 +98,7 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) for (i = 0; led_commands[i].string; i++) { if ((strcmp("all", argv[1]) == 0) || (strcmp(led_commands[i].string, argv[1]) == 0)) { + match = 1; if (led_commands[i].on) { if (state) { led_commands[i].on(); @@ -112,7 +113,7 @@ int do_led (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } /* If we ran out of matches, print Usage */ - if (!led_commands[i].string && !(strcmp("all", argv[1]) == 0)) { + if (!match) { return cmd_usage(cmdtp); }