diff options
Diffstat (limited to 'software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c')
-rw-r--r-- | software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c index 3f4baed..36a07c4 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c @@ -33,6 +33,8 @@ $Octasic_Revision: 336 $ /***************************** INCLUDE FILES *******************************/ +#include <linux/slab.h> + #include "octdef.h" #include "oct6100api/oct6100_defines.h" @@ -272,7 +274,7 @@ UINT32 Oct6100ChipOpen( tPOCT6100_INSTANCE_API f_pApiInstance, tPOCT6100_CHIP_OPEN f_pChipOpen ) { - tOCT6100_API_INSTANCE_SIZES InstanceSizes; + tOCT6100_API_INSTANCE_SIZES *InstanceSizes; UINT32 ulStructSize; UINT32 ulResult; UINT32 ulTempVar; @@ -310,13 +312,20 @@ UINT32 Oct6100ChipOpen( if ( ulResult != cOCT6100_ERR_OK ) return ulResult; + InstanceSizes = kmalloc(sizeof(tOCT6100_API_INSTANCE_SIZES), GFP_KERNEL); + if (!InstanceSizes) + return cOCT6100_ERR_FATAL_0; /* Calculate the amount of memory needed for the API instance structure. */ - ulResult = Oct6100ApiCalculateInstanceSizes( f_pChipOpen, &InstanceSizes ); - if ( ulResult != cOCT6100_ERR_OK ) + ulResult = Oct6100ApiCalculateInstanceSizes( f_pChipOpen, InstanceSizes ); + if ( ulResult != cOCT6100_ERR_OK ) { + kfree(InstanceSizes); return ulResult; + } /* Allocate the memory for the API instance structure internal pointers. */ - ulResult = Oct6100ApiAllocateInstanceMemory( f_pApiInstance, &InstanceSizes ); + ulResult = Oct6100ApiAllocateInstanceMemory( f_pApiInstance, InstanceSizes ); + kfree(InstanceSizes); + if ( ulResult != cOCT6100_ERR_OK ) return ulResult; |