From patchwork Sat May 14 15:49:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 95566 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 0F2811007D1 for ; Sun, 15 May 2011 02:02:22 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8874B280B5; Sat, 14 May 2011 18:01:58 +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 zJMNmV3IhbE5; Sat, 14 May 2011 18:01:58 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 35A4A280BC; Sat, 14 May 2011 18:01:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D38552808D for ; Sat, 14 May 2011 18:01:17 +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 Yar9D0hhQY-X for ; Sat, 14 May 2011 18:01:17 +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 smtpi4.ngi.it (smtpi4.ngi.it [88.149.128.104]) by theia.denx.de (Postfix) with ESMTP id 016D528096 for ; Sat, 14 May 2011 18:01:12 +0200 (CEST) Received: from wallace (88-149-225-30.dynamic.ngi.it [88.149.225.30]) by smtpi4.ngi.it (Postfix) with ESMTP id 431BE42997; Sat, 14 May 2011 17:51:08 +0200 (CEST) From: Luca Ceresoli To: u-boot@lists.denx.de Date: Sat, 14 May 2011 17:49:59 +0200 Message-Id: <1305388203-22983-5-git-send-email-luca.ceresoli@comelit.it> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1305388203-22983-1-git-send-email-luca.ceresoli@comelit.it> References: <1305388203-22983-1-git-send-email-luca.ceresoli@comelit.it> Cc: Luca Ceresoli Subject: [U-Boot] [PATCH 4/8] net/tftp.c: cosmetic: do not use assignment in if condition 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 This removes the following checkpatch issue: - ERROR: do not use assignment in if condition. There is one such error left: ERROR: do not use assignment in if condition #239: FILE: tftp.c:239: + if (!ProhibitMcast + && (Bitmap = malloc(Mapsize)) + && eth_get_dev()->mcast) { which would require an additional nested if to be fixed, resulting in longer and less readable code. Signed-off-by: Luca Ceresoli Cc: Wolfgang Denk --- net/tftp.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/net/tftp.c b/net/tftp.c index 4c05266..81b7aa5 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -552,10 +552,12 @@ TftpStart(void) * Allow the user to choose TFTP blocksize and timeout. * TFTP protocol has a minimal timeout of 1 second. */ - if ((ep = getenv("tftpblocksize")) != NULL) + ep = getenv("tftpblocksize"); + if (ep != NULL) TftpBlkSizeOption = simple_strtol(ep, NULL, 10); - if ((ep = getenv("tftptimeout")) != NULL) + ep = getenv("tftptimeout"); + if (ep != NULL) TftpTimeoutMSecs = simple_strtol(ep, NULL, 10); if (TftpTimeoutMSecs < 1000) { @@ -635,10 +637,12 @@ TftpStart(void) TftpOurPort = 1024 + (get_timer(0) % 3072); #ifdef CONFIG_TFTP_PORT - if ((ep = getenv("tftpdstp")) != NULL) { + ep = getenv("tftpdstp"); + if (ep != NULL) { TftpServerPort = simple_strtol(ep, NULL, 10); } - if ((ep = getenv("tftpsrcp")) != NULL) { + ep = getenv("tftpsrcp"); + if (ep != NULL) { TftpOurPort = simple_strtol(ep, NULL, 10); } #endif @@ -721,7 +725,8 @@ static void parse_multicast_oack(char *pkt, int len) /* I malloc instead of pre-declare; so that if the file ends * up being too big for this bitmap I can retry */ - if (!(Bitmap = malloc(Mapsize))) { + Bitmap = malloc(Mapsize); + if (!Bitmap) { printf("No Bitmap, no multicast. Sorry.\n"); ProhibitMcast = 1; return; @@ -734,7 +739,8 @@ static void parse_multicast_oack(char *pkt, int len) if (Mcast_addr != addr) { if (Mcast_addr) eth_mcast_join(Mcast_addr, 0); - if (eth_mcast_join(Mcast_addr = addr, 1)) { + Mcast_addr = addr; + if (eth_mcast_join(Mcast_addr, 1)) { printf("Fail to set mcast, revert to TFTP\n"); ProhibitMcast = 1; mcast_cleanup();