[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100826084746.4fd266f7@nehalam>
Date: Thu, 26 Aug 2010 08:47:46 -0700
From: Stephen Hemminger <shemminger@...tta.com>
To: Masayuki Ohtake <masa-korg@....okisemi.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
ML netdev <netdev@...r.kernel.org>,
Greg Rose <gregory.v.rose@...el.com>,
Maxime Bizon <mbizon@...ebox.fr>,
Kristoffer Glembo <kristoffer@...sler.com>,
Ralf Baechle <ralf@...ux-mips.org>,
John Linn <john.linn@...inx.com>,
Randy Dunlap <randy.dunlap@...cle.com>,
"David S. Miller" <davem@...emloft.net>,
MeeGo <meego-dev@...go.com>, "Wang, Qi" <qi.wang@...el.com>,
"Wang, Yong Y" <yong.y.wang@...el.com>,
Andrew <andrew.chih.howe.khor@...el.com>,
Intel OTC <joel.clark@...el.com>,
"Foster, Margie" <margie.foster@...el.com>,
Toshiharu Okada <okada533@....okisemi.com>,
Tomoya Morinaga <morinaga526@....okisemi.com>,
Takahiro Shimizu <shimizu394@....okisemi.com>
Subject: Re: [PATCH] Gigabit Ethernet driver of Topcliff PCH
On Thu, 26 Aug 2010 18:56:55 +0900
Masayuki Ohtake <masa-korg@....okisemi.com> wrote:
> +/**
> + * pch_gbe_alloc_queues - Allocate memory for all rings
> + * @adapter: Board private structure to initialize
> + * Returns
> + * 0: Successfully
> + * Negative value: Failed
> + */
> +static int pch_gbe_alloc_queues(struct pch_gbe_adapter *adapter)
> +{
> + int size;
> +
> + PCH_GBE_DEBUG("%s\n", __func__);
> +
> +
> + size = (int)sizeof(struct pch_gbe_tx_ring);
> + adapter->tx_ring = kmalloc(size, GFP_KERNEL);
> + if (!adapter->tx_ring)
> + return -ENOMEM;
> + memset(adapter->tx_ring, 0, size);
> +
> + size = (int)sizeof(struct pch_gbe_rx_ring);
> + adapter->rx_ring = kmalloc(size, GFP_KERNEL);
> + if (!adapter->rx_ring) {
> + kfree(adapter->tx_ring);
> + return -ENOMEM;
> + }
> + memset(adapter->rx_ring, 0, size);
> +
> + size = (int)sizeof(struct net_device);
> + adapter->polling_netdev = kmalloc(size, GFP_KERNEL);
> + if (!adapter->polling_netdev) {
> + kfree(adapter->tx_ring);
> + kfree(adapter->rx_ring);
> + return -ENOMEM;
This is not allowed, you can not just allocate up a network
device structure out of kmalloc space. Not sure what you are doing
with the polling_netdev? Is it left over from when net_device
and NAPI were more closely bound?
--
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists