diff --git a/common/tegra_hwpm_alist_utils.c b/common/tegra_hwpm_alist_utils.c index 6a13a05..f6d9c2f 100644 --- a/common/tegra_hwpm_alist_utils.c +++ b/common/tegra_hwpm_alist_utils.c @@ -66,7 +66,7 @@ int tegra_soc_hwpm_update_allowlist(struct tegra_soc_hwpm *hwpm, tegra_hwpm_fn(hwpm, " "); - if (hwpm->full_alist_size < 0) { + if (hwpm->full_alist_size < 0ULL) { tegra_hwpm_err(hwpm, "Invalid allowlist size"); return -EINVAL; } diff --git a/common/tegra_hwpm_mem_buf_utils.c b/common/tegra_hwpm_mem_buf_utils.c index e08d5e8..f7ea2ae 100644 --- a/common/tegra_hwpm_mem_buf_utils.c +++ b/common/tegra_hwpm_mem_buf_utils.c @@ -138,7 +138,7 @@ static int tegra_hwpm_reset_stream_buf(struct tegra_soc_hwpm *hwpm) int tegra_hwpm_map_stream_buffer(struct tegra_soc_hwpm *hwpm, struct tegra_soc_hwpm_alloc_pma_stream *alloc_pma_stream) { - int ret = 0; + int ret = 0, err = 0; tegra_hwpm_fn(hwpm, " "); @@ -185,8 +185,8 @@ fail: tegra_hwpm_err(hwpm, "invalidate_mem_config HAL uninitialized"); return -ENODEV; } - ret = hwpm->active_chip->invalidate_mem_config(hwpm); - if (ret != 0) { + err = hwpm->active_chip->invalidate_mem_config(hwpm); + if (err != 0) { tegra_hwpm_err(hwpm, "Failed to invalidate memory config"); } @@ -195,16 +195,16 @@ fail: tegra_hwpm_err(hwpm, "disable_mem_mgmt HAL uninitialized"); return -ENODEV; } - ret = hwpm->active_chip->disable_mem_mgmt(hwpm); - if (ret != 0) { + err = hwpm->active_chip->disable_mem_mgmt(hwpm); + if (err != 0) { tegra_hwpm_err(hwpm, "Failed to disable memory management"); } alloc_pma_stream->stream_buf_pma_va = 0; /* Reset stream buffer */ - ret = tegra_hwpm_reset_stream_buf(hwpm); - if (ret != 0) { + err = tegra_hwpm_reset_stream_buf(hwpm); + if (err != 0) { tegra_hwpm_err(hwpm, "Failed to reset stream buffer"); } @@ -230,12 +230,14 @@ int tegra_hwpm_clear_mem_pipeline(struct tegra_soc_hwpm *hwpm) if (ret != 0) { tegra_hwpm_err(hwpm, "Failed to trigger mem_bytes streaming"); + goto fail; } timeout = HWPM_TIMEOUT(*mem_bytes_kernel_u32 != TEGRA_SOC_HWPM_MEM_BYTES_INVALID, "MEM_BYTES streaming"); - if (timeout && ret == 0) { + if (timeout) { ret = -EIO; + goto fail; } } @@ -246,6 +248,7 @@ int tegra_hwpm_clear_mem_pipeline(struct tegra_soc_hwpm *hwpm) ret = hwpm->active_chip->disable_pma_streaming(hwpm); if (ret != 0) { tegra_hwpm_err(hwpm, "Failed to disable pma streaming"); + goto fail; } /* Disable memory management */ @@ -256,14 +259,16 @@ int tegra_hwpm_clear_mem_pipeline(struct tegra_soc_hwpm *hwpm) ret = hwpm->active_chip->disable_mem_mgmt(hwpm); if (ret != 0) { tegra_hwpm_err(hwpm, "Failed to disable memory management"); + goto fail; } /* Reset stream buffer */ ret = tegra_hwpm_reset_stream_buf(hwpm); if (ret != 0) { tegra_hwpm_err(hwpm, "Failed to reset stream buffer"); + goto fail; } - +fail: return ret; } diff --git a/hal/t234/t234_hwpm_ip_utils.c b/hal/t234/t234_hwpm_ip_utils.c index 632d61a..9e20c71 100644 --- a/hal/t234/t234_hwpm_ip_utils.c +++ b/hal/t234/t234_hwpm_ip_utils.c @@ -314,7 +314,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, if (ret != 0) { tegra_hwpm_err(hwpm, "Failed to %s fs/ops for IP %d perfmux %d", - available ? "set" : "reset", + available == true ? "set" : "reset", ip_idx, perfmux_idx); goto fail; } @@ -336,8 +336,8 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, if (ret != 0) { tegra_hwpm_err(hwpm, "IP %d perfmux %d: fs/ops %s failed", - available ? "set" : "reset", - ip_idx, perfmux_idx); + ip_idx, perfmux_idx, + available == true ? "set" : "reset"); goto fail; } } @@ -363,7 +363,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, tegra_hwpm_err(hwpm, "IP %d perfmux %d: fs/ops %s failed", ip_idx, perfmux_idx, - available ? "set" : "reset"); + available == true ? "set" : "reset"); goto fail; } } @@ -389,7 +389,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, tegra_hwpm_err(hwpm, "IP %d perfmux %d: fs/ops %s failed", ip_idx, perfmux_idx, - available ? "set" : "reset"); + available == true ? "set" : "reset"); goto fail; } } diff --git a/hal/t234/t234_hwpm_regops_utils.c b/hal/t234/t234_hwpm_regops_utils.c index 7d1762d..ca3c933 100644 --- a/hal/t234/t234_hwpm_regops_utils.c +++ b/hal/t234/t234_hwpm_regops_utils.c @@ -238,6 +238,7 @@ int t234_hwpm_exec_reg_ops(struct tegra_soc_hwpm *hwpm, tegra_hwpm_dbg(hwpm, hwpm_verbose, "Found phys addr (0x%llx): aperture (0x%llx-0x%llx)", + reg_op->phys_addr, aperture->start_abs_pa, aperture->end_abs_pa); switch (reg_op->cmd) { diff --git a/os/linux/tegra_hwpm_io.c b/os/linux/tegra_hwpm_io.c index b9cdbb2..4ee9cb0 100644 --- a/os/linux/tegra_hwpm_io.c +++ b/os/linux/tegra_hwpm_io.c @@ -55,7 +55,7 @@ static u32 ip_readl(struct tegra_soc_hwpm *hwpm, struct hwpm_ip_aperture *aperture, u64 offset) { tegra_hwpm_dbg(hwpm, hwpm_register, - "Aperture (0x%llx-0x%llx) offset(0x%x)", + "Aperture (0x%llx-0x%llx) offset(0x%llx)", aperture->start_abs_pa, aperture->end_abs_pa, offset); if (hwpm->fake_registers_enabled) { @@ -147,9 +147,8 @@ static u32 hwpm_readl(struct tegra_soc_hwpm *hwpm, struct hwpm_ip_aperture *aperture, u32 offset) { tegra_hwpm_dbg(hwpm, hwpm_register, - "Aperture (0x%llx-0x%llx) base 0x%llx offset(0x%x)", - aperture->start_abs_pa, aperture->end_abs_pa, - (u64 *)aperture->dt_mmio, offset); + "Aperture (0x%llx-0x%llx) offset(0x%x)", + aperture->start_abs_pa, aperture->end_abs_pa, offset); if (aperture->dt_mmio == NULL) { tegra_hwpm_err(hwpm, "aperture is not iomapped as expected"); @@ -171,9 +170,8 @@ static void hwpm_writel(struct tegra_soc_hwpm *hwpm, struct hwpm_ip_aperture *aperture, u32 offset, u32 val) { tegra_hwpm_dbg(hwpm, hwpm_register, - "Aperture (0x%llx-0x%llx) base 0x%llx offset(0x%x) val(0x%x)", - aperture->start_abs_pa, aperture->end_abs_pa, - (u64 *)aperture->dt_mmio, offset, val); + "Aperture (0x%llx-0x%llx) offset(0x%x) val(0x%x)", + aperture->start_abs_pa, aperture->end_abs_pa, offset, val); if (aperture->dt_mmio == NULL) { tegra_hwpm_err(hwpm, "aperture is not iomapped as expected");