Skip to content

Commit

Permalink
Change copyFreePinnedMemory() to return error status
Browse files Browse the repository at this point in the history
Change-Id: I3f4547d8a3016a2c3784dbd87a258c7d32d455b5
Signed-off-by: Steve Linsell <stevenx.linsell@intel.com>
  • Loading branch information
Yogaraj-Alamenda authored and stevelinsell committed Jan 23, 2018
1 parent ef236aa commit e027a3c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
6 changes: 4 additions & 2 deletions cmn_mem_drv_inf.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,16 @@ void *copyAllocPinnedMemoryClean(void *ptr, size_t size, size_t original_size,
return nptr;
}

void copyFreePinnedMemory(void *uptr, void *kptr, int size)
int copyFreePinnedMemory(void *uptr, void *kptr, int size)
{
if (uptr == NULL || kptr == NULL) {
MEM_WARN("Input pointers uptr or kptr are NULL\n");
return;
return 0;
}

memcpy(uptr, kptr, size);
qaeCryptoMemFree(kptr);
return 1;
}

CpaPhysicalAddr qaeCryptoMemV2P(void *v)
Expand Down
2 changes: 1 addition & 1 deletion cmn_mem_drv_inf.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ void *copyAllocPinnedMemory(void *ptr, size_t size, const char *file,
int line);
void *copyAllocPinnedMemoryClean(void *ptr, size_t size, size_t original_size,
const char *file, int line);
void copyFreePinnedMemory(void *uptr, void *kptr, int size);
int copyFreePinnedMemory(void *uptr, void *kptr, int size);

#endif /* CMN_MEM_DRV_INF_H */
10 changes: 8 additions & 2 deletions multi_thread_qaememutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,21 @@ void *copyAllocPinnedMemoryClean(void *ptr, size_t size, size_t original_size,
* buffer and copy data to it.
*
******************************************************************************/
void copyFreePinnedMemory(void *uptr, void *kptr, int size)
int copyFreePinnedMemory(void *uptr, void *kptr, int size)
{
if (uptr == NULL || kptr == NULL) {
MEM_WARN("Input pointers uptr or kptr are NULL\n");
return;
return 0;
}

if (size > MAX_ALLOC) {
MEM_WARN("Size greater than MAX_ALLOC\n");
return 0;
}

memcpy(uptr, kptr, size);
qaeCryptoMemFree(kptr);
return 1;
}

/*****************************************************************************
Expand Down
7 changes: 4 additions & 3 deletions qae_mem_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,20 +331,21 @@ void *copyAllocPinnedMemoryClean(void *ptr, size_t size, size_t original_size,
* buffer and copy data to it.
*
******************************************************************************/
void copyFreePinnedMemory(void *uptr, void *kptr, int size)
int copyFreePinnedMemory(void *uptr, void *kptr, int size)
{
if (uptr == NULL || kptr == NULL) {
MEM_WARN("Input pointers uptr or kptr are NULL\n");
return;
return 0;
}

if (size > MAX_ALLOC) {
MEM_WARN("Size greater than MAX_ALLOC\n");
return;
return 0;
}

memcpy(uptr, kptr, size);
qaeCryptoMemFree(kptr);
return 1;
}

/*****************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion qae_mem_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void *copyAllocPinnedMemory(void *ptr, size_t size, const char *file,
int line);
void *copyAllocPinnedMemoryClean(void *ptr, size_t size, size_t original_size,
const char *file, int line);
void copyFreePinnedMemory(void *uptr, void *kptr, int size);
int copyFreePinnedMemory(void *uptr, void *kptr, int size);

void qaeCryptoAtFork();

Expand Down

0 comments on commit e027a3c

Please sign in to comment.