From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning
Date: Mon, 20 Jul 2009 21:49:42 -0700 [thread overview]
Message-ID: <4A6548E6.3080909@gmail.com> (raw)
In-Reply-To: <20090717121700.9c3f1e56.kim.phillips@freescale.com>
Kim,
Kim Phillips wrote:
> fix this gcc 4.4 warning:
>
> tsec.c: In function 'tsec_init':
> tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rules
>
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> ---
> this is the endian-correct version
>
> drivers/net/tsec.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
> index 63fc02e..5dc05e5 100644
> --- a/drivers/net/tsec.c
> +++ b/drivers/net/tsec.c
> @@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd)
> for (i = 0; i < MAC_ADDR_LEN; i++) {
> tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->enetaddr[i];
> }
> - regs->macstnaddr1 = *((uint *) (tmpbuf));
> + tempval = (tmpbuf[0] << 24) | (tmpbuf[1] << 16) | (tmpbuf[2] << 8) |
> + tmpbuf[3];
> +
> + regs->macstnaddr1 = tempval;
>
> tempval = *((uint *) (tmpbuf + 4));
>
>
Applied to net repo.
thanks,
Ben
prev parent reply other threads:[~2009-07-21 4:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-15 16:50 [U-Boot] [PATCH] net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning Kim Phillips
2009-06-18 5:14 ` Ben Warren
[not found] ` <2acbd3e40906181519h8c14828pf167c0c197a6e828@mail.gmail.com>
[not found] ` <4A56D89D.2040900@gmail.com>
2009-07-17 17:17 ` [U-Boot] [PATCH v2] " Kim Phillips
2009-07-21 4:49 ` Ben Warren [this message]
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=4A6548E6.3080909@gmail.com \
--to=biggerbadderben@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox