* [U-Boot] [PATCH] drivers/net/dnet.c: Fix GCC 4.6 warnings
@ 2011-11-19 20:06 Anatolij Gustschin
2011-11-23 7:34 ` Heiko Schocher
0 siblings, 1 reply; 2+ messages in thread
From: Anatolij Gustschin @ 2011-11-19 20:06 UTC (permalink / raw)
To: u-boot
Fix:
dnet.c: In function 'dnet_send':
dnet.c:136:9: warning: variable 'len' set but not used
[-Wunused-but-set-variable]
dnet.c: In function 'dnet_set_hwaddr':
dnet.c:209:2: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]
dnet.c:209:2: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]
dnet.c:209:2: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]
dnet.c:209:2: warning: dereferencing type-punned pointer will
break strict-aliasing rules [-Wstrict-aliasing]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
drivers/net/dnet.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index bfe87fa..15d0a6e 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -20,6 +20,7 @@
#include <miiphy.h>
#include <asm/io.h>
+#include <asm/unaligned.h>
#include "dnet.h"
@@ -133,15 +134,12 @@ static int dnet_send(struct eth_device *netdev, volatile void *packet,
int length)
{
struct dnet_device *dnet = to_dnet(netdev);
- int i, len, wrsz;
+ int i, wrsz;
unsigned int *bufp;
unsigned int tx_cmd;
debug(DRIVERNAME "[%s] Sending %u bytes\n", __func__, length);
- /* frame size (words) */
- len = (length + 3) >> 2;
-
bufp = (unsigned int *) (((u32)packet) & 0xFFFFFFFC);
wrsz = (u32)length + 3;
wrsz += ((u32)packet) & 0x3;
@@ -206,11 +204,11 @@ static void dnet_set_hwaddr(struct eth_device *netdev)
struct dnet_device *dnet = to_dnet(netdev);
u16 tmp;
- tmp = cpu_to_be16(*((u16 *)netdev->enetaddr));
+ tmp = get_unaligned_be16(netdev->enetaddr);
dnet_writew_mac(dnet, DNET_INTERNAL_MAC_ADDR_0_REG, tmp);
- tmp = cpu_to_be16(*((u16 *)(netdev->enetaddr + 2)));
+ tmp = get_unaligned_be16(&netdev->enetaddr[2]);
dnet_writew_mac(dnet, DNET_INTERNAL_MAC_ADDR_1_REG, tmp);
- tmp = cpu_to_be16(*((u16 *)(netdev->enetaddr + 4)));
+ tmp = get_unaligned_be16(&netdev->enetaddr[4]);
dnet_writew_mac(dnet, DNET_INTERNAL_MAC_ADDR_2_REG, tmp);
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] drivers/net/dnet.c: Fix GCC 4.6 warnings
2011-11-19 20:06 [U-Boot] [PATCH] drivers/net/dnet.c: Fix GCC 4.6 warnings Anatolij Gustschin
@ 2011-11-23 7:34 ` Heiko Schocher
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Schocher @ 2011-11-23 7:34 UTC (permalink / raw)
To: u-boot
Hello Anatolij,
Anatolij Gustschin wrote:
> Fix:
> dnet.c: In function 'dnet_send':
> dnet.c:136:9: warning: variable 'len' set but not used
> [-Wunused-but-set-variable]
> dnet.c: In function 'dnet_set_hwaddr':
> dnet.c:209:2: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> dnet.c:209:2: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> dnet.c:209:2: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> dnet.c:209:2: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> drivers/net/dnet.c | 12 +++++-------
> 1 files changed, 5 insertions(+), 7 deletions(-)
Applied to u-boot-stagin hs at denx.de
Thanks!
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-23 7:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-19 20:06 [U-Boot] [PATCH] drivers/net/dnet.c: Fix GCC 4.6 warnings Anatolij Gustschin
2011-11-23 7:34 ` Heiko Schocher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox