Skip to content

Commit 2a8c84e

Browse files
committed
simplify logic
1 parent f62e6f8 commit 2a8c84e

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

unified-runtime/source/loader/layers/sanitizer/asan/asan_shadow.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,9 @@ ur_result_t ShadowMemoryGPU::Destroy() {
153153
Context, (void *)MappedPtr, PageSize));
154154
UR_CALL(getContext()->urDdiTable.PhysicalMem.pfnRelease(PhysicalMem));
155155
}
156-
if (ShadowBegin != 0) {
157-
UR_CALL(getContext()->urDdiTable.VirtualMem.pfnFree(
158-
Context, (const void *)ShadowBegin, GetShadowSize()));
159-
ShadowBegin = ShadowEnd = 0;
160-
}
156+
UR_CALL(getContext()->urDdiTable.VirtualMem.pfnFree(
157+
Context, (const void *)ShadowBegin, GetShadowSize()));
158+
ShadowBegin = ShadowEnd = 0;
161159
}
162160

163161
// NOTE: Context is managed by base class, so it needn't release here

unified-runtime/source/loader/layers/sanitizer/msan/msan_shadow.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,9 @@ ur_result_t ShadowMemoryGPU::Destroy() {
253253
Context, (void *)MappedPtr, PageSize));
254254
UR_CALL(getContext()->urDdiTable.PhysicalMem.pfnRelease(PhysicalMem));
255255
}
256-
if (ShadowBegin != 0) {
257-
UR_CALL(getContext()->urDdiTable.VirtualMem.pfnFree(
258-
Context, (const void *)ShadowBegin, GetShadowSize()));
259-
ShadowBegin = ShadowEnd = 0;
260-
}
256+
UR_CALL(getContext()->urDdiTable.VirtualMem.pfnFree(
257+
Context, (const void *)ShadowBegin, GetShadowSize()));
258+
ShadowBegin = ShadowEnd = 0;
261259
}
262260

263261
UR_CALL(ReleaseCleanShadow());

0 commit comments

Comments
 (0)