Skip to content

Commit 9f051d6

Browse files
Hawking Zhangalexdeucher
authored andcommitted
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: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Stanley Yang <Stanley.Yang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 2031c46 commit 9f051d6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
764764
{
765765
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
766766
union ta_ras_cmd_input *info;
767-
int ret = 0;
767+
int ret;
768768

769769
if (!con)
770770
return -EINVAL;
@@ -773,7 +773,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
773773
if (enable &&
774774
head->block != AMDGPU_RAS_BLOCK__GFX &&
775775
!amdgpu_ras_is_feature_allowed(adev, head))
776-
goto out;
776+
return 0;
777777

778778
/* Only enable gfx ras feature from host side */
779779
if (head->block == AMDGPU_RAS_BLOCK__GFX &&
@@ -801,16 +801,16 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
801801
enable ? "enable":"disable",
802802
get_ras_block_str(head),
803803
amdgpu_ras_is_poison_mode_supported(adev), ret);
804-
goto out;
804+
return ret;
805805
}
806+
807+
kfree(info);
806808
}
807809

808810
/* setup the obj */
809811
__amdgpu_ras_feature_enable(adev, head, enable);
810-
out:
811-
if (head->block == AMDGPU_RAS_BLOCK__GFX)
812-
kfree(info);
813-
return ret;
812+
813+
return 0;
814814
}
815815

816816
/* Only used in device probe stage and called only once. */

0 commit comments

Comments
 (0)