Commit 9f051d6f authored by Hawking Zhang's avatar Hawking Zhang Committed by Alex Deucher

drm/amdgpu: Free ras cmd input buffer properly

Do not access the pointer for ras input cmd buffer
if it is even not allocated.
Signed-off-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarStanley Yang <Stanley.Yang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 2031c46b
...@@ -764,7 +764,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, ...@@ -764,7 +764,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
{ {
struct amdgpu_ras *con = amdgpu_ras_get_context(adev); struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
union ta_ras_cmd_input *info; union ta_ras_cmd_input *info;
int ret = 0; int ret;
if (!con) if (!con)
return -EINVAL; return -EINVAL;
...@@ -773,7 +773,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, ...@@ -773,7 +773,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
if (enable && if (enable &&
head->block != AMDGPU_RAS_BLOCK__GFX && head->block != AMDGPU_RAS_BLOCK__GFX &&
!amdgpu_ras_is_feature_allowed(adev, head)) !amdgpu_ras_is_feature_allowed(adev, head))
goto out; return 0;
/* Only enable gfx ras feature from host side */ /* Only enable gfx ras feature from host side */
if (head->block == AMDGPU_RAS_BLOCK__GFX && if (head->block == AMDGPU_RAS_BLOCK__GFX &&
...@@ -801,16 +801,16 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, ...@@ -801,16 +801,16 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
enable ? "enable":"disable", enable ? "enable":"disable",
get_ras_block_str(head), get_ras_block_str(head),
amdgpu_ras_is_poison_mode_supported(adev), ret); amdgpu_ras_is_poison_mode_supported(adev), ret);
goto out; return ret;
} }
kfree(info);
} }
/* setup the obj */ /* setup the obj */
__amdgpu_ras_feature_enable(adev, head, enable); __amdgpu_ras_feature_enable(adev, head, enable);
out:
if (head->block == AMDGPU_RAS_BLOCK__GFX) return 0;
kfree(info);
return ret;
} }
/* Only used in device probe stage and called only once. */ /* Only used in device probe stage and called only once. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment