mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-24 02:07:34 +03:00
tegra: hwpm: fix reported coverity violations
- Declare and initialize timeout and mem_bytes_kernel_u32 variables. - alist_map NULL pointer check is done after alist_map structure references. Modify update_allowlist ioctl and release alist_map functions to check alist_map NULL pointer before it's use. - Checking if unsigned _IOC_NR(cmd) is less than zero has no effect. Remove this check. - Correct printf format specifier for mem_bytes_addr. Bug 3461002 Change-Id: I79a97942e667c173d112bcaafb14ddcb8dd7d47f Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765676 Reviewed-by: Vasuki Shankar <vasukis@nvidia.com> Reviewed-by: Seema Khowala <seemaj@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
d58dbfe5a9
commit
14d527e97a
@@ -22,14 +22,28 @@ int tegra_hwpm_get_allowlist_size(struct tegra_soc_hwpm *hwpm)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
hwpm->alist_map->full_alist_size = 0ULL;
|
||||
|
||||
tegra_hwpm_fn(hwpm, " ");
|
||||
|
||||
ret = tegra_hwpm_func_all_ip(hwpm, NULL, TEGRA_HWPM_GET_ALIST_SIZE);
|
||||
if (ret != 0) {
|
||||
tegra_hwpm_err(hwpm, "get_alist_size failed");
|
||||
return ret;
|
||||
if (hwpm->alist_map == NULL) {
|
||||
/* Allocate tegra_hwpm_allowlist_map */
|
||||
hwpm->alist_map = tegra_hwpm_kzalloc(hwpm,
|
||||
sizeof(struct tegra_hwpm_allowlist_map));
|
||||
if (!hwpm->alist_map) {
|
||||
tegra_hwpm_err(NULL,
|
||||
"Couldn't allocate allowlist map structure");
|
||||
return -ENOMEM;
|
||||
}
|
||||
hwpm->alist_map->full_alist_size = 0ULL;
|
||||
}
|
||||
|
||||
if (hwpm->alist_map->full_alist_size == 0) {
|
||||
/* Full alist size is not computed yet */
|
||||
ret = tegra_hwpm_func_all_ip(hwpm, NULL,
|
||||
TEGRA_HWPM_GET_ALIST_SIZE);
|
||||
if (ret != 0) {
|
||||
tegra_hwpm_err(hwpm, "get_alist_size failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user