mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-25 10:43:14 +03:00
tegra: hwpm: resolve coverity defects
Resolve coverity violations: - Correct invalid arguments in debug prints - Modify if statement to compare similar data types - Update tegra_hwpm_map_stream_buffer() return statements. Bug 3461002 Change-Id: Ic299a594bc371bac4a96a035f31961a586486083 Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2675433 Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Seema Khowala <seemaj@nvidia.com> Reviewed-by: Vasuki Shankar <vasukis@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
92be6f7a00
commit
7f5bfd3176
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user