drm/amdgpu: Free ras cmd input buffer properly
Subsystems (2)
PATCH 1/1 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 <[email protected]>
Reviewed-by Stanley Yang <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +7 -7
@@ -764,7 +764,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, {struct amdgpu_ras *con =amdgpu_ras_get_context (adev);union ta_ras_cmd_input *info; -int ret =0 ; +int ret;if (!con)return -EINVAL ;
@@ -774,7 +774,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,/* Force issue enable or disable ras feature commands */ if (head->block !=AMDGPU_RAS_BLOCK__GFX && !amdgpu_ras_is_feature_allowed (adev, head)) - goto out; +return 0 ;/* Only enable gfx ras feature from host side */ if (head->block == AMDGPU_RAS_BLOCK__GFX &&
@@ -802,16 +802,16 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, enable ?"enable" :"disable" ,get_ras_block_str (head), amdgpu_ras_is_poison_mode_supported(adev), ret); - goto out; +return ret; } + +kfree (info); }/* setup the obj */ __amdgpu_ras_feature_enable (adev, head, enable); -out: -if (head->block ==AMDGPU_RAS_BLOCK__GFX ) -kfree (info); -return ret; + +return 0 ; }/* Only used in device probe stage and called only once. */
Signature · 1 line
2.17.1