Skip to content

Commit b3b86cc

Browse files
committed
Fixed coverity issue in acl_auto_configure.cpp: Type: Unused value (UNUSED_VALUE)
1 parent 5994a1c commit b3b86cc

File tree

5 files changed

+25
-38
lines changed

5 files changed

+25
-38
lines changed

src/acl_auto_configure.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -724,15 +724,12 @@ static bool read_accel_defs(const std::string &config_str,
724724
accel[i].mem.next = reinterpret_cast<void *>(0x00020000);
725725

726726
int total_fields_kernel = 0;
727-
if (result) {
728-
result = read_int_counters(config_str, curr_pos, total_fields_kernel,
729-
counters);
730-
}
727+
result = result && read_int_counters(config_str, curr_pos,
728+
total_fields_kernel, counters);
731729
counters.emplace_back(total_fields_kernel);
732730

733-
result =
734-
read_string_counters(config_str, curr_pos, hal_info[i].name, counters);
735-
731+
result = result && read_string_counters(config_str, curr_pos,
732+
hal_info[i].name, counters);
736733
if (!result)
737734
break;
738735
accel[i].iface.name = hal_info[i].name;

src/acl_kernel_if.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,9 +1258,8 @@ void acl_kernel_if_launch_kernel_on_custom_sof(
12581258
offset = (unsigned int)(KERNEL_OFFSET_INVOCATION_IMAGE +
12591259
kern->cra_address_offset);
12601260
image_p = (uintptr_t) & (image->work_dim);
1261-
image_size_static =
1262-
(size_t)((uintptr_t) & (image->arg_value) - (uintptr_t) &
1263-
(image->work_dim));
1261+
image_size_static = (size_t)(
1262+
(uintptr_t) & (image->arg_value) - (uintptr_t) & (image->work_dim));
12641263
}
12651264

12661265
if ((kern->io.debug_verbosity) >= 2) {

src/acl_mem.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,7 @@ CL_API_ENTRY cl_mem clCreateBufferWithPropertiesINTEL(
438438
case CL_MEM_ALLOC_BUFFER_LOCATION_INTEL: {
439439
tmp_mem_id = (cl_uint) * (properties + 1);
440440
} break;
441-
default: {
442-
BAIL_INFO(CL_INVALID_DEVICE, context, "Invalid properties");
443-
}
441+
default: { BAIL_INFO(CL_INVALID_DEVICE, context, "Invalid properties"); }
444442
}
445443
properties += 2;
446444
}
@@ -5566,8 +5564,8 @@ void acl_mem_migrate_buffer(void *user_data, acl_device_op_t *op) {
55665564

55675565
#ifdef MEM_DEBUG_MSG
55685566
printf("release block %zx (%u:%u) ",
5569-
(size_t)(src_mem->reserved_allocations[src_device]
5570-
[src_mem_id]),
5567+
(size_t)(
5568+
src_mem->reserved_allocations[src_device][src_mem_id]),
55715569
src_device, src_mem_id);
55725570
#endif
55735571
remove_mem_block_linked_list(
@@ -5953,9 +5951,8 @@ static void l_mem_transfer_buffer_explicitly(cl_context context,
59535951
dst_unmap_cmd.info.mem_xfer.map_flags = CL_MAP_WRITE;
59545952
}
59555953
dst_unmap_cmd.info.mem_xfer.src_mem = context->unwrapped_host_mem;
5956-
dst_unmap_cmd.info.mem_xfer.src_offset[0] =
5957-
(size_t)((char *)dst_mem->host_mem.aligned_ptr -
5958-
(char *)ACL_MEM_ALIGN);
5954+
dst_unmap_cmd.info.mem_xfer.src_offset[0] = (size_t)(
5955+
(char *)dst_mem->host_mem.aligned_ptr - (char *)ACL_MEM_ALIGN);
59595956
dst_unmap_cmd.info.mem_xfer.src_offset[1] = 0;
59605957
dst_unmap_cmd.info.mem_xfer.src_offset[2] = 0;
59615958
dst_unmap_cmd.info.mem_xfer.dst_mem = dst_mem;
@@ -6319,9 +6316,8 @@ void acl_copy_device_buffers_to_host_before_programming(
63196316
cmd.info.mem_xfer.src_offset[2] = 0;
63206317
cmd.info.mem_xfer.dst_mem = context2->unwrapped_host_mem;
63216318
if (mem->flags & CL_MEM_USE_HOST_PTR) {
6322-
cmd.info.mem_xfer.dst_offset[0] =
6323-
(size_t)((char *)mem->fields.buffer_objs.host_ptr -
6324-
(char *)ACL_MEM_ALIGN);
6319+
cmd.info.mem_xfer.dst_offset[0] = (size_t)(
6320+
(char *)mem->fields.buffer_objs.host_ptr - (char *)ACL_MEM_ALIGN);
63256321
} else {
63266322
cmd.info.mem_xfer.dst_offset[0] =
63276323
(size_t)((char *)mem->host_mem.aligned_ptr - (char *)ACL_MEM_ALIGN);
@@ -6465,9 +6461,8 @@ void acl_copy_device_buffers_from_host_after_programming(
64656461
cmd.type = CL_COMMAND_WRITE_BUFFER;
64666462
cmd.info.mem_xfer.src_mem = context2->unwrapped_host_mem;
64676463
if (mem->flags & CL_MEM_USE_HOST_PTR) {
6468-
cmd.info.mem_xfer.src_offset[0] =
6469-
(size_t)((char *)mem->fields.buffer_objs.host_ptr -
6470-
(char *)ACL_MEM_ALIGN);
6464+
cmd.info.mem_xfer.src_offset[0] = (size_t)(
6465+
(char *)mem->fields.buffer_objs.host_ptr - (char *)ACL_MEM_ALIGN);
64716466
} else {
64726467
cmd.info.mem_xfer.src_offset[0] =
64736468
(size_t)((char *)mem->host_mem.aligned_ptr - (char *)ACL_MEM_ALIGN);

src/acl_printf.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -911,11 +911,13 @@ static size_t l_dump_printf_buffer(cl_event event, cl_kernel kernel,
911911
length = get_length_specifier(data_elem._conversion_string);
912912

913913
#ifdef DEBUG
914-
printf("length specifier=%s\n", length == LS_HL ? "LS_HL"
915-
: length == LS_HH ? "LS_HH"
916-
: length == LS_H ? "LS_H"
917-
: length == LS_L ? "LS_L"
918-
: "NONE");
914+
printf("length specifier=%s\n",
915+
length == LS_HL
916+
? "LS_HL"
917+
: length == LS_HH
918+
? "LS_HH"
919+
: length == LS_H ? "LS_H"
920+
: length == LS_L ? "LS_L" : "NONE");
919921
#endif
920922

921923
// the size of the data we are converting right now

src/acl_usm.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ CL_API_ENTRY void *CL_API_CALL clHostMemAllocINTEL(
112112
case CL_MEM_ALLOC_BUFFER_LOCATION_INTEL: {
113113
mem_id = (cl_uint) * (properties + 1);
114114
} break;
115-
default: {
116-
BAIL_INFO(CL_INVALID_PROPERTY, context, "Invalid properties");
117-
}
115+
default: { BAIL_INFO(CL_INVALID_PROPERTY, context, "Invalid properties"); }
118116
}
119117
properties += 2;
120118
}
@@ -267,9 +265,7 @@ clDeviceMemAllocINTEL(cl_context context, cl_device_id device,
267265
case CL_MEM_ALLOC_BUFFER_LOCATION_INTEL: {
268266
mem_id = (cl_uint) * (properties + 1);
269267
} break;
270-
default: {
271-
BAIL_INFO(CL_INVALID_DEVICE, context, "Invalid properties");
272-
}
268+
default: { BAIL_INFO(CL_INVALID_DEVICE, context, "Invalid properties"); }
273269
}
274270
properties += 2;
275271
}
@@ -421,9 +417,7 @@ clSharedMemAllocINTEL(cl_context context, cl_device_id device,
421417
}
422418
mem_id = (cl_uint) * (properties + 1);
423419
} break;
424-
default: {
425-
BAIL_INFO(CL_INVALID_PROPERTY, context, "Invalid properties");
426-
}
420+
default: { BAIL_INFO(CL_INVALID_PROPERTY, context, "Invalid properties"); }
427421
}
428422
properties += 2;
429423
}

0 commit comments

Comments
 (0)