From ae958a9625d6af127e018812aba24b02e4ef3a34 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Wed, 9 Aug 2006 18:07:42 +0000 Subject: restore stack space optimization done in older version of this code git-svn-id: http://svn.asterisk.org/svn/octasic_api/oct612x/trunk@6 537310ab-6354-42db-a3cc-247b777f7be6 --- .../oct6100api/oct6100_api/oct6100_channel.c | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c index 40a94f5..1a204b2 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c @@ -32,6 +32,8 @@ $Octasic_Revision: 469 $ /***************************** INCLUDE FILES *******************************/ +#include + #include "octdef.h" #include "oct6100api/oct6100_defines.h" @@ -3490,16 +3492,21 @@ UINT32 Oct6100ChannelModifySer( UINT8 fSinSoutCodecActive = FALSE; UINT8 fRinRoutCodecActive = FALSE; UINT16 usNewPhasingTsstIndex; - tOCT6100_CHANNEL_OPEN TempChanOpen; + tOCT6100_CHANNEL_OPEN *pTempChanOpen; + + /* We don't want this 290 byte structure on the stack */ + pTempChanOpen = kmalloc(sizeof(*pTempChanOpen), GFP_ATOMIC); + if (!pTempChanOpen) + return cOCT6100_ERR_CHANNEL_NOT_OPEN; /* Check the user's configuration of the echo cancellation channel for errors. */ ulResult = Oct6100ApiCheckChannelModify( f_pApiInstance, f_pChannelModify, - &TempChanOpen, + pTempChanOpen, &usNewPhasingTsstIndex, &usChanIndex ); if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; + goto out; /* Reserve all resources needed by the echo cancellation channel. */ ulResult = Oct6100ApiModifyChannelResources( f_pApiInstance, @@ -3510,12 +3517,12 @@ UINT32 Oct6100ChannelModifySer( &usNewRoutTsstIndex, &usNewSoutTsstIndex ); if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; + goto out; /* Write all necessary structures to activate the echo cancellation channel. */ ulResult = Oct6100ApiModifyChannelStructs( f_pApiInstance, f_pChannelModify, - &TempChanOpen, + pTempChanOpen, usChanIndex, usNewPhasingTsstIndex, &fSinSoutCodecActive, @@ -3525,12 +3532,12 @@ UINT32 Oct6100ChannelModifySer( usNewRoutTsstIndex, usNewSoutTsstIndex ); if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; + goto out; /* Update the new echo cancellation channels's entry in the ECHO channel list. */ ulResult = Oct6100ApiModifyChannelEntry( f_pApiInstance, f_pChannelModify, - &TempChanOpen, + pTempChanOpen, usChanIndex, usNewPhasingTsstIndex, fSinSoutCodecActive, @@ -3542,7 +3549,10 @@ UINT32 Oct6100ChannelModifySer( if ( ulResult != cOCT6100_ERR_OK ) return ulResult; - return cOCT6100_ERR_OK; +out: + kfree(pTempChanOpen); + + return ulResult; } /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -- cgit v1.2.3