Skip to content

Commit

Permalink
fix coverity issues (#249)
Browse files Browse the repository at this point in the history
Signed-off-by: Max Zhen <max.zhen@amd.com>
  • Loading branch information
maxzhen authored Sep 10, 2024
1 parent 2bac8eb commit dfd9ad5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/driver/amdxdna/aie2_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ static int aie2_get_firmware_version(struct amdxdna_client *client,
static int aie2_get_power_mode(struct amdxdna_client *client,
struct amdxdna_drm_get_info *args)
{
struct amdxdna_drm_get_power_mode mode;
struct amdxdna_drm_get_power_mode mode = {};
struct amdxdna_dev *xdna = client->xdna;
struct amdxdna_dev_hdl *ndev;

Expand Down
2 changes: 1 addition & 1 deletion src/driver/amdxdna/aie2_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ int aie2_smu_set_dpm_level(struct amdxdna_dev_hdl *ndev, u32 dpm_level)
{
int ret;

if (dpm_level < 0 || dpm_level > SMU_DPM_MAX(ndev))
if (dpm_level > SMU_DPM_MAX(ndev))
return -EINVAL;

if (!ndev->priv->smu_rev)
Expand Down
3 changes: 1 addition & 2 deletions src/shim/umq/hwq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ fill_indirect_exec_buf(uint64_t slot_idx, uint16_t cu_idx,
volatile struct host_indirect_packet_entry *hp =
reinterpret_cast<volatile struct host_indirect_packet_entry *>(pkt->data);

for (int i = 0; dpu && dpu->chained >= 0;
i++, hp++, dpu = get_ert_dpu_data_next(dpu)) {
for (int i = 0; dpu; i++, hp++, dpu = get_ert_dpu_data_next(dpu)) {
auto data_size = sizeof(struct host_indirect_data) * HSA_INDIRECT_PKT_NUM;
auto prefix_off = get_pkt_idx(slot_idx) * data_size;
auto prefix_idx = get_pkt_idx(slot_idx) * HSA_INDIRECT_PKT_NUM;
Expand Down
3 changes: 2 additions & 1 deletion test/shim_test/io_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ int verify_output(int8_t* buf, const std::string &wrk_path)
std::cout << "Examing output: " << dump_output_files[i] << std::endl;
break;
} else {
std::remove(dump_output_files[i].c_str());
if (std::remove(dump_output_files[i].c_str()))
std::cout << "Failed to remove " << dump_output_files[i] << std::endl;
}
}

Expand Down

0 comments on commit dfd9ad5

Please sign in to comment.