summaryrefslogtreecommitdiffstats
path: root/drivers/staging/sxg
diff options
context:
space:
mode:
authorMithlesh Thukral <mithlesh@linsyssoft.com>2009-02-24 18:09:34 +0530
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-03 14:53:13 -0700
commit9fd6966c62e6ad770a8b193d71d36beb9b82d351 (patch)
tree7bada51d9d6357cfa3f916726ec200cc4d7cd56e /drivers/staging/sxg
parentbbb18b97f6bcf1d55814ce08bdaf6c358b16c8bb (diff)
downloadop-kernel-dev-9fd6966c62e6ad770a8b193d71d36beb9b82d351.zip
op-kernel-dev-9fd6966c62e6ad770a8b193d71d36beb9b82d351.tar.gz
Staging: sxg: Fix memory leak caused by double allocation of rings
* The receive rings were getting allocated twice. Once at probe time and once at open time. This leaked huge amounts of memory. Fix this leak and now allocation is done only once. Signed-off-by: LinSysSoft Sahara Team <saharaproj@linsyssoft.com> Signed-off-by: Mithlesh Thukral <mithlesh@linsyssoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/sxg')
-rw-r--r--drivers/staging/sxg/sxg.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/drivers/staging/sxg/sxg.c b/drivers/staging/sxg/sxg.c
index d52212a..c914b98 100644
--- a/drivers/staging/sxg/sxg.c
+++ b/drivers/staging/sxg/sxg.c
@@ -613,8 +613,7 @@ static bool sxg_download_microcode(struct adapter_t *adapter,
*/
static int sxg_allocate_resources(struct adapter_t *adapter)
{
- int status;
- u32 i;
+ int status = STATUS_SUCCESS;
u32 RssIds, IsrCount;
/* struct sxg_xmt_ring *XmtRing; */
/* struct sxg_rcv_ring *RcvRing; */
@@ -736,30 +735,6 @@ static int sxg_allocate_resources(struct adapter_t *adapter)
ASSERT(sizeof(struct sxg_rcv_descriptor_block) ==
SXG_RCV_DESCRIPTOR_BLOCK_SIZE);
- /*
- * Allocate receive data buffers. We allocate a block of buffers and
- * a corresponding descriptor block at once. See sxghw.h:SXG_RCV_BLOCK
- */
- for (i = 0; i < SXG_INITIAL_RCV_DATA_BUFFERS;
- i += SXG_RCV_DESCRIPTORS_PER_BLOCK) {
- status = sxg_allocate_buffer_memory(adapter,
- SXG_RCV_BLOCK_SIZE(SXG_RCV_DATA_HDR_SIZE),
- SXG_BUFFER_TYPE_RCV);
- if (status != STATUS_SUCCESS)
- return status;
- }
- /*
- * NBL resource allocation can fail in the 'AllocateComplete' routine,
- * which doesn't return status. Make sure we got the number of buffers
- * we requested
- */
- if (adapter->FreeRcvBufferCount < SXG_INITIAL_RCV_DATA_BUFFERS) {
- SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "XAResF6",
- adapter, adapter->FreeRcvBufferCount, SXG_MAX_ENTRIES,
- 0);
- return (STATUS_RESOURCES);
- }
-
DBG_ERROR("%s Allocate EventRings size[%x]\n", __func__,
(unsigned int)(sizeof(struct sxg_event_ring) * RssIds));
OpenPOWER on IntegriCloud