Skip to content

Commit 64ae995

Browse files
committed
sycl-ref: remove redundant NULL guards on sycl::free calls
SYCL spec §4.8.3.6 guarantees sycl::free(nullptr, ctx) is a no-op, matching the behavior of std::free(NULL). The NULL checks on d_array_owned and reduction_norm are unnecessary.
1 parent 716118c commit 64ae995

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

backends/sycl-ref/ceed-sycl-vector.sycl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,8 @@ static int CeedVectorDestroy_Sycl(const CeedVector vec) {
691691
CeedCallBackend(CeedGetData(ceed, &data));
692692

693693
CeedCallSycl(ceed, data->sycl_queue.wait_and_throw());
694-
if (impl->d_array_owned) CeedCallSycl(ceed, sycl::free(impl->d_array_owned, data->sycl_context));
695-
if (impl->reduction_norm) CeedCallSycl(ceed, sycl::free(impl->reduction_norm, data->sycl_context));
694+
CeedCallSycl(ceed, sycl::free(impl->d_array_owned, data->sycl_context));
695+
CeedCallSycl(ceed, sycl::free(impl->reduction_norm, data->sycl_context));
696696

697697
CeedCallBackend(CeedFree(&impl->h_array_owned));
698698
CeedCallBackend(CeedFree(&impl));

0 commit comments

Comments
 (0)