]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Fix a few gcc warnings.
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>
Mon, 25 Apr 2011 01:39:43 +0000 (01:39 +0000)
committerWolfgang Denk <wd@denx.de>
Thu, 12 May 2011 21:17:52 +0000 (23:17 +0200)
Noticed while building all of mpc8xx. Also
constify usage string in timer.c
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 <Joakim.Tjernlund@transmode.se>
board/netta/codec.c
board/siemens/IAD210/atm.c
examples/standalone/timer.c

index 844aa184aa3c8be6b9b00c6c2955491ef4bbdb21..c8d31d72e4cff76c8e666d1851f33e0149b5c745 100644 (file)
@@ -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;
index e599c1061ba8fa55d097ef255d73e9748f98774c..40aad0ac265f0def9c90091d6dd213bd007f0e6f 100644 (file)
@@ -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;
 }
index 834cc9a49ef2690d82356c3f679b8df619ed1ec3..8fd38b222c987f5f5e55249050736ff80cf40faa 100644 (file)
@@ -113,7 +113,7 @@ typedef struct tid_8xx_cpmtimer_s {
 
 void setPeriod (tid_8xx_cpmtimer_t *hwp, ulong interval);
 
-static char *usage = "\n[q, b, e, ?] ";
+static const char usage[] = "\n[q, b, e, ?] ";
 
 int timer (int argc, char * const argv[])
 {
@@ -186,7 +186,7 @@ int timer (int argc, char * const argv[])
        /* clear all events */
        *hwp->terp = (CPMT_EVENT_CAP | CPMT_EVENT_REF);
 
-       printf (usage);
+       puts(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);
+           puts(usage);
        }
        if (running) {
                printf ("Stopping timer\n");