From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Thu, 24 Nov 2011 18:05:15 +0100 Subject: [U-Boot] [PATCH] board/esd/cpci405/cpci405.c: Fix GCC 4.6 warning In-Reply-To: <4ECE6529.8050307@esd.eu> References: <4ECE6529.8050307@esd.eu> Message-ID: <201111241805.15420.marek.vasut@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > Signed-off-by: Matthias Fuchs > --- > board/esd/cpci405/cpci405.c | 8 +++----- > 1 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/board/esd/cpci405/cpci405.c b/board/esd/cpci405/cpci405.c > index 98a8584..41b5ba0 100644 > --- a/board/esd/cpci405/cpci405.c > +++ b/board/esd/cpci405/cpci405.c > @@ -656,7 +656,6 @@ int do_onewire(cmd_tbl_t *cmdtp, int flag, int argc, > char * const argv[]) int i; > unsigned char ow_id[6]; > char str[32]; > - unsigned char ow_crc; > > /* > * Clear 1-wire bit (open drain with pull-up) > @@ -675,11 +674,10 @@ int do_onewire(cmd_tbl_t *cmdtp, int flag, int argc, > char * const argv[]) OWReadByte(); /* skip family code ( == 0x01) */ > for (i = 0; i < 6; i++) > ow_id[i] = OWReadByte(); > - ow_crc = OWReadByte(); /* read crc */ > + OWReadByte(); /* read crc */ Are you sure this doesn't get optimized out? Did you test this patch please? > > - sprintf(str, "%08X%04X", > - *(unsigned int *)&ow_id[0], > - *(unsigned short *)&ow_id[4]); > + sprintf(str, "%02X%02X%02X%02X%02X%02X", > + ow_id[0], ow_id[1], ow_id[2], ow_id[3], ow_id[4], ow_id[5]); > printf("Setting environment variable 'ow_id' to %s\n", str); > setenv("ow_id", str); This does indeed look eerie, the old code. Ok, good, I'll assign this gcc4.6 thing to myself and start picking these.