From patchwork Sun Apr 24 23:39:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Tjernlund X-Patchwork-Id: 92681 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 44671B6F59 for ; Mon, 25 Apr 2011 09:39:55 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AC1242812A; Mon, 25 Apr 2011 01:39:52 +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 9w8PkNm8jDgH; Mon, 25 Apr 2011 01:39:52 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 340682811F; Mon, 25 Apr 2011 01:39:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 302722811F for ; Mon, 25 Apr 2011 01:39:49 +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 Qe8KCrAX4cfs for ; Mon, 25 Apr 2011 01:39:48 +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 gw1.transmode.se (gw1.transmode.se [195.58.98.146]) by theia.denx.de (Postfix) with ESMTPS id 045742811C for ; Mon, 25 Apr 2011 01:39:46 +0200 (CEST) Received: from sesr04.transmode.se (sesr04.transmode.se [192.168.201.15]) by gw1.transmode.se (Postfix) with ESMTP id DC67E258043; Mon, 25 Apr 2011 01:39:45 +0200 (CEST) In-Reply-To: <20110424221458.90B6CD5269F@gemini.denx.de> References: <20110420201335.BC035152160@gemini.denx.de> <1303633774-22961-3-git-send-email-Joakim.Tjernlund@transmode.se> <20110424221458.90B6CD5269F@gemini.denx.de> X-KeepSent: 833C8DA9:727EDC2B-C125787C:0081D5F1; type=4; name=$KeepSent To: Wolfgang Denk X-Mailer: Lotus Notes Release 8.5.2 August 10, 2010 Message-ID: From: Joakim Tjernlund Date: Mon, 25 Apr 2011 01:39:44 +0200 X-MIMETrack: Serialize by Router on sesr04/Transmode(Release 8.5.2FP1|November 29, 2010) at 2011-04-25 01:39:45 MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH 2/3] Fix a few gcc warnings. 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Wolfgang Denk wrote on 2011/04/25 00:14:58: > > Dear Joakim Tjernlund, > > In message <1303633774-22961-3-git-send-email-Joakim.Tjernlund@transmode.se> you wrote: > > Noticed while building all of mpc8xx > > Please include in the commit message what the compiler warnings were, > and which compiler version was used to produce these warnings. > > > > diff --git a/examples/standalone/timer.c b/examples/standalone/timer.c > > index 834cc9a..a4d4581 100644 > > --- a/examples/standalone/timer.c > > +++ b/examples/standalone/timer.c > > @@ -186,7 +186,7 @@ int timer (int argc, char * const argv[]) > > /* clear all events */ > > *hwp->terp = (CPMT_EVENT_CAP | CPMT_EVENT_REF); > > > > - printf (usage); > > + printf("%s", usage); > > I dislike this change. Which warning does the old code produce for > you? Updated patch below with the warnings in the commit msg: From 6f84407cd1afdd9c45c28219985fc4e05e2e35dc Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Sat, 23 Apr 2011 11:43:51 +0200 Subject: [PATCH 2/3] Fix a few gcc warnings. Noticed while building all of mpc8xx Warnings fixed are: timer.c: In function 'timer': timer.c:189: warning: format not a string literal and no format arguments timer.c:258: warning: format not a string literal and no format arguments atm.c: In function 'atmUnload': atm.c:99: warning: array subscript is above array bounds atm.c: In function 'atmLoad': atm.c:65: warning: array subscript is above array bounds codec.c: In function 'codsp_write_pop_int': codec.c:678: warning: array subscript is above array bounds codec.c: In function 'codsp_write_cop_short': codec.c:585: warning: array subscript is above array bounds codec.c: In function 'codsp_write_sop_int': codec.c:512: warning: array subscript is above array bounds Signed-off-by: Joakim Tjernlund --- -V2: Add descprition of warnings. board/netta/codec.c | 6 +++--- board/siemens/IAD210/atm.c | 4 ++-- examples/standalone/timer.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) -- 1.7.3.4 diff --git a/board/netta/codec.c b/board/netta/codec.c index 844aa18..c8d31d7 100644 --- a/board/netta/codec.c +++ b/board/netta/codec.c @@ -502,7 +502,7 @@ void codsp_write_sop_short(int duslic_id, int channel, unsigned char regno, unsi void codsp_write_sop_int(int duslic_id, int channel, unsigned char regno, unsigned int val) { - unsigned char cmd[5]; + unsigned char cmd[6]; cmd[0] = CODSP_WR | CODSP_ADR(channel) | CODSP_CMD_SOP; cmd[1] = regno; @@ -577,7 +577,7 @@ void codsp_write_cop_char(int duslic_id, int channel, unsigned char addr, unsign void codsp_write_cop_short(int duslic_id, int channel, unsigned char addr, unsigned short val) { - unsigned char cmd[3]; + unsigned char cmd[4]; cmd[0] = CODSP_WR | CODSP_OP | CODSP_ADR(channel) | CODSP_CMD_COP; cmd[1] = addr; @@ -668,7 +668,7 @@ void codsp_write_pop_short (int duslic_id, int channel, unsigned char regno, void codsp_write_pop_int (int duslic_id, int channel, unsigned char regno, unsigned int val) { - unsigned char cmd[5]; + unsigned char cmd[6]; cmd[0] = CODSP_WR | CODSP_ADR (channel) | CODSP_CMD_POP; cmd[1] = regno; diff --git a/board/siemens/IAD210/atm.c b/board/siemens/IAD210/atm.c index e599c10..40aad0a 100644 --- a/board/siemens/IAD210/atm.c +++ b/board/siemens/IAD210/atm.c @@ -62,7 +62,7 @@ int atmLoad() volatile iop8xx_t *iop = &immap->im_ioport; timers->cpmt_tgcr &= 0x0FFF; SYNC; /* Disable Timer 4 */ - immap->im_cpm.cp_scc[4].scc_gsmrl = 0x0; SYNC; /* Disable SCC4 */ + immap->im_cpm.cp_scc[3].scc_gsmrl = 0x0; SYNC; /* Disable SCC4 */ iop->iop_pdpar &= 0x3FFF; SYNC; /* Disable SAR and UTOPIA */ if ( atmMemInit() != OK ) return ERROR; @@ -96,7 +96,7 @@ void atmUnload() volatile iop8xx_t *iop = &immap->im_ioport; timers->cpmt_tgcr &= 0x0FFF; SYNC; /* Disable Timer 4 */ - immap->im_cpm.cp_scc[4].scc_gsmrl = 0x0; SYNC; /* Disable SCC4 */ + immap->im_cpm.cp_scc[3].scc_gsmrl = 0x0; SYNC; /* Disable SCC4 */ iop->iop_pdpar &= 0x3FFF; SYNC; /* Disable SAR and UTOPIA */ g_atm.loaded = FALSE; } diff --git a/examples/standalone/timer.c b/examples/standalone/timer.c index 834cc9a..a4d4581 100644 --- a/examples/standalone/timer.c +++ b/examples/standalone/timer.c @@ -186,7 +186,7 @@ int timer (int argc, char * const argv[]) /* clear all events */ *hwp->terp = (CPMT_EVENT_CAP | CPMT_EVENT_REF); - printf (usage); + printf("%s", usage); running = 0; while ((c = getc()) != 'q') { if (c == 'b') { @@ -255,7 +255,7 @@ int timer (int argc, char * const argv[]) } else { printf ("\nEnter: q - quit, b - start timer, e - stop timer, ? - get status\n"); } - printf (usage); + printf("%s", usage); } if (running) { printf ("Stopping timer\n");