From patchwork Mon May 16 05:24:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 95675 X-Patchwork-Delegate: wd@denx.de 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 F3FE7B6EEC for ; Mon, 16 May 2011 15:42:53 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 438FE28087; Mon, 16 May 2011 07:42:52 +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 UXyjVN7x0uO4; Mon, 16 May 2011 07:42:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9EC4928081; Mon, 16 May 2011 07:42:49 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 71AB628081 for ; Mon, 16 May 2011 07:42:48 +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 oS4VfOdPQJgU for ; Mon, 16 May 2011 07:42:47 +0200 (CEST) X-Greylist: delayed 1111 seconds by postgrey-1.27 at theia; Mon, 16 May 2011 07:42:45 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 mail1.asahi-net.or.jp (mail1.asahi-net.or.jp [202.224.39.197]) by theia.denx.de (Postfix) with ESMTP id 071382807F for ; Mon, 16 May 2011 07:42:45 +0200 (CEST) Received: from sk22g2 (y081184.ppp.asahi-net.or.jp [118.243.81.184]) by mail1.asahi-net.or.jp (Postfix) with ESMTP id 5600AE41B7 for ; Mon, 16 May 2011 14:24:12 +0900 (JST) Received: from 10A1130.labs.sios.com.ath.cx (unknown [192.168.16.128]) by sk22g2 (Postfix) with ESMTP id E935BE63 for ; Mon, 16 May 2011 14:24:11 +0900 (JST) Date: Mon, 16 May 2011 14:24:11 +0900 Message-ID: <87vcxbp69w.wl%ysato@users.sourceforge.jp> From: Yoshinori Sato To: u-boot@lists.denx.de User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.8 Emacs/23.3 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Subject: [U-Boot] [PATCH] sh_eth.c: EDMAC descriptor leak 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Hi, I found memory leak in sh_eth.c. sh_eth_desc_init call for many times in network problem. And it every time allocate new descriptor. So leak old descriptor. I will fix this patch. diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 17dd0d2..f805785 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -313,6 +313,9 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth) struct sh_eth_info *port_info = ð->port_info[port]; struct tx_desc_s *cur_tx_desc; + if (port_info->tx_desc_malloc) + /* Already allocated. re-using it */ + return 0; /* * Allocate tx descriptors. They must be TX_DESC_SIZE bytes aligned */ @@ -365,6 +368,9 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth) u32 tmp_addr; u8 *rx_buf; + if (port_info->rx_desc_malloc) + /* Already allocated. re-using it */ + return 0; /* * Allocate rx descriptors. They must be RX_DESC_SIZE bytes aligned */