diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2006-08-09 18:07:42 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2011-02-27 21:09:14 +0200 |
commit | ae958a9625d6af127e018812aba24b02e4ef3a34 (patch) | |
tree | b8fbe252bf1f5aedce8b4816c1a1fda7f9316c50 | |
parent | 46c5a4235aa52aba0daf9a96e89785f1edea05d2 (diff) |
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
-rw-r--r-- | software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c | 26 |
1 files 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 <linux/slab.h> + #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; } /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |