Skip to content

Commit cb979bd

Browse files
committed
Remove dead code
Remove dead code - remove checks run always earlier in src/memory_provider.c. Signed-off-by: Lukasz Dorau <[email protected]>
1 parent cdc0310 commit cb979bd

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

src/provider/provider_coarse.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,8 +1573,7 @@ static umf_result_t coarse_memory_provider_allocation_split(void *provider,
15731573
void *ptr,
15741574
size_t totalSize,
15751575
size_t firstSize) {
1576-
if (provider == NULL || ptr == NULL || (firstSize >= totalSize) ||
1577-
firstSize == 0) {
1576+
if (provider == NULL) {
15781577
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
15791578
}
15801579

@@ -1643,9 +1642,7 @@ static umf_result_t coarse_memory_provider_allocation_merge(void *provider,
16431642
void *lowPtr,
16441643
void *highPtr,
16451644
size_t totalSize) {
1646-
if (provider == NULL || lowPtr == NULL || highPtr == NULL ||
1647-
((uintptr_t)highPtr <= (uintptr_t)lowPtr) ||
1648-
((uintptr_t)highPtr - (uintptr_t)lowPtr >= totalSize)) {
1645+
if (provider == NULL) {
16491646
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
16501647
}
16511648

src/provider/provider_devdax_memory.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,9 @@ static umf_result_t devdax_allocation_split(void *provider, void *ptr,
361361
static umf_result_t devdax_allocation_merge(void *provider, void *lowPtr,
362362
void *highPtr, size_t totalSize) {
363363
(void)provider;
364-
365-
if ((uintptr_t)highPtr <= (uintptr_t)lowPtr) {
366-
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
367-
}
368-
369-
if ((uintptr_t)highPtr - (uintptr_t)lowPtr <= totalSize) {
370-
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
371-
}
364+
(void)lowPtr;
365+
(void)highPtr;
366+
(void)totalSize;
372367

373368
return UMF_RESULT_SUCCESS;
374369
}

0 commit comments

Comments
 (0)