All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] board/esd/cpci405/cpci405.c: Fix GCC 4.6 warning
Date: Thu, 24 Nov 2011 18:05:15 +0100	[thread overview]
Message-ID: <201111241805.15420.marek.vasut@gmail.com> (raw)
In-Reply-To: <4ECE6529.8050307@esd.eu>

> Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu>
> ---
>  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.

  reply	other threads:[~2011-11-24 17:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24 15:39 [U-Boot] [PATCH] board/esd/cpci405/cpci405.c: Fix GCC 4.6 warning Matthias Fuchs
2011-11-24 17:05 ` Marek Vasut [this message]
2011-11-24 17:40 ` Mike Frysinger
2011-11-25  8:33   ` Marek Vasut
2011-11-25 19:56     ` Mike Frysinger
2011-11-25 12:50   ` Matthias Fuchs
2011-12-07 20:22 ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201111241805.15420.marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.