From patchwork Sat Nov 19 20:06:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 126607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 52C12B7225 for ; Sun, 20 Nov 2011 07:06:44 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 341DD28807; Sat, 19 Nov 2011 21:06:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TEQDf20HwwNy; Sat, 19 Nov 2011 21:06:37 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EB49D28750; Sat, 19 Nov 2011 21:06:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8474028750 for ; Sat, 19 Nov 2011 21:06:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AtVdLpsav3rQ for ; Sat, 19 Nov 2011 21:06:31 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by theia.denx.de (Postfix) with ESMTP id B275C2871A for ; Sat, 19 Nov 2011 21:06:30 +0100 (CET) Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 90A4C186DEC4 for ; Sat, 19 Nov 2011 21:09:05 +0100 (CET) X-Auth-Info: 3UB1A2RcKKk0ezDYJ3qWFt9gT3ziWoN7fHUcXK0fjx0= Received: from localhost (p4FC46DF7.dip.t-dialin.net [79.196.109.247]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3A00C1C00066 for ; Sat, 19 Nov 2011 21:06:29 +0100 (CET) From: Anatolij Gustschin To: u-boot@lists.denx.de Date: Sat, 19 Nov 2011 21:06:30 +0100 Message-Id: <1321733190-5947-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 Subject: [U-Boot] [PATCH] drivers/net/dnet.c: Fix GCC 4.6 warnings X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- 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 #include +#include #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); }