Skip to content

Commit 5f9e6c5

Browse files
committed
Fix coverity warnings in reqd_work_group_size
1 parent 3b7f35b commit 5f9e6c5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

source/adapters/native_cpu/program.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "common.hpp"
1414
#include "program.hpp"
1515
#include <cstdint>
16+
#include <memory>
1617

1718
UR_APIEXPORT ur_result_t UR_APICALL
1819
urProgramCreateWithIL(ur_context_handle_t hContext, const void *pIL,
@@ -72,11 +73,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary(
7273
UR_ASSERT(phProgram, UR_RESULT_ERROR_INVALID_NULL_POINTER);
7374
UR_ASSERT(pBinary != nullptr, UR_RESULT_ERROR_INVALID_NULL_POINTER);
7475

75-
auto hProgram = new ur_program_handle_t_(
76+
auto hProgram = std::make_unique<ur_program_handle_t_>(
7677
hContext, reinterpret_cast<const unsigned char *>(pBinary));
7778
if (pProperties != nullptr) {
7879
for (uint32_t i = 0; i < pProperties->count; i++) {
79-
auto mdNode = pProperties->pMetadatas[i];
80+
const auto &mdNode = pProperties->pMetadatas[i];
8081
std::string mdName(mdNode.pName);
8182
auto [Prefix, Tag] = splitMetadataName(mdName);
8283
if (Tag == __SYCL_UR_PROGRAM_METADATA_TAG_REQD_WORK_GROUP_SIZE) {
@@ -98,7 +99,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary(
9899
nativecpu_it++;
99100
}
100101

101-
*phProgram = hProgram;
102+
*phProgram = hProgram.release();
102103

103104
return UR_RESULT_SUCCESS;
104105
}

source/adapters/native_cpu/program.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <ur_api.h>
1414

1515
#include "context.hpp"
16+
17+
#include <array>
1618
#include <map>
1719

1820
namespace native_cpu {

0 commit comments

Comments
 (0)