From patchwork Tue May 17 04:27:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 95850 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 4571EB6EDD for ; Tue, 17 May 2011 14:27:54 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BE94F2807F; Tue, 17 May 2011 06:27:51 +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 aWpZpEmNAZwt; Tue, 17 May 2011 06:27:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3CDB828080; Tue, 17 May 2011 06:27:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3161928080 for ; Tue, 17 May 2011 06:27:47 +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 7QatsWi-zCCS for ; Tue, 17 May 2011 06:27:46 +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-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by theia.denx.de (Postfix) with ESMTPS id 03D342807F for ; Tue, 17 May 2011 06:27:44 +0200 (CEST) Received: by pzk5 with SMTP id 5so74328pzk.3 for ; Mon, 16 May 2011 21:27:42 -0700 (PDT) Received: by 10.68.39.195 with SMTP id r3mr340053pbk.354.1305606462665; Mon, 16 May 2011 21:27:42 -0700 (PDT) Received: from localhost.localdomain (gate1.alliedtelesyn.co.nz [202.49.72.36]) by mx.google.com with ESMTPS id w1sm119704pbf.1.2011.05.16.21.27.40 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 May 2011 21:27:41 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Date: Tue, 17 May 2011 16:27:11 +1200 Message-Id: <1305606431-13473-1-git-send-email-judge.packham@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: References: Cc: Luuk Paulussen , biggerbadderben@gmail.com Subject: [U-Boot] [PATCHv2] sntp: avoid use of uninitialized variable 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: Luuk Paulussen When we use the ntpserverip environment variable argv[1] may not be set. Printing the error message using the NetNtpServerIP variable ensures the correct output in both cases. Signed-off-by: Luuk Paulussen Acked-by: Chris Packham Cc: Ben Warren Acked-by: Detlev Zundel --- Changes since v1: - run through checkpatch.pl, fix line > 80 chars common/cmd_net.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/common/cmd_net.c b/common/cmd_net.c index 8c6f5c8..fae3c7f 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -324,7 +324,8 @@ int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) else NetTimeOffset = simple_strtol (toff, NULL, 10); if (NetLoop(SNTP) < 0) { - printf("SNTP failed: host %s not responding\n", argv[1]); + printf("SNTP failed: host %pI4 not responding\n", + &NetNtpServerIP); return 1; }