From patchwork Tue Sep 13 07:09:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 114434 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 7D003B70B7 for ; Tue, 13 Sep 2011 17:11:13 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BC84D2826E; Tue, 13 Sep 2011 09:10:54 +0200 (CEST) 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 qItfGmHccwwN; Tue, 13 Sep 2011 09:10:54 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8981728287; Tue, 13 Sep 2011 09:10:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BE7B82822C for ; Tue, 13 Sep 2011 09:10:30 +0200 (CEST) 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 pxY5XvvqZSeU for ; Tue, 13 Sep 2011 09:10:30 +0200 (CEST) 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-bw0-f44.google.com (mail-bw0-f44.google.com [209.85.214.44]) by theia.denx.de (Postfix) with ESMTPS id 4D45A28235 for ; Tue, 13 Sep 2011 09:10:30 +0200 (CEST) Received: by mail-bw0-f44.google.com with SMTP id q10so194975bka.3 for ; Tue, 13 Sep 2011 00:10:30 -0700 (PDT) Received: by 10.204.9.152 with SMTP id l24mr2506086bkl.103.1315897830040; Tue, 13 Sep 2011 00:10:30 -0700 (PDT) Received: from localhost ([178.23.216.97]) by mx.google.com with ESMTPS id z7sm453940bkt.5.2011.09.13.00.10.29 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Sep 2011 00:10:29 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de Date: Tue, 13 Sep 2011 09:09:58 +0200 Message-Id: <1315897821-23049-4-git-send-email-monstr@monstr.eu> X-Mailer: git-send-email 1.5.5.1 In-Reply-To: <1315897821-23049-3-git-send-email-monstr@monstr.eu> References: <1315897821-23049-1-git-send-email-monstr@monstr.eu> <1315897821-23049-2-git-send-email-monstr@monstr.eu> <1315897821-23049-3-git-send-email-monstr@monstr.eu> Subject: [U-Boot] [PATCH 03/26] net: emaclite: Use calloc instead of malloc X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 Simplify driver logic and clear eth_device structure in one command. Signed-off-by: Michal Simek --- drivers/net/xilinx_emaclite.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 2a5c5e1..28aab97 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -344,11 +344,10 @@ int xilinx_emaclite_initialize (bd_t *bis, int base_addr) { struct eth_device *dev; - dev = malloc(sizeof(*dev)); + dev = calloc(1, sizeof(*dev)); if (dev == NULL) return -1; - memset(dev, 0, sizeof(*dev)); sprintf(dev->name, "Xelite.%x", base_addr); dev->iobase = base_addr;