Commit 3e4aeff3 authored by Chen Tao's avatar Chen Tao Committed by Alex Deucher

drm/amdgpu/debugfs: fix memory leak when pm_runtime_get_sync failed

Fix memory leak in amdgpu_debugfs_gpr_read not freeing data when
pm_runtime_get_sync failed.

Fixes: a9ffe2a9 ("drm/amdgpu/debugfs: properly handle runtime pm")
Signed-off-by: default avatarChen Tao <chentao107@huawei.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent db32fec9
......@@ -937,7 +937,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
r = pm_runtime_get_sync(adev->ddev->dev);
if (r < 0)
return r;
goto err;
r = amdgpu_virt_enable_access_debugfs(adev);
if (r < 0)
......@@ -967,7 +967,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
value = data[result >> 2];
r = put_user(value, (uint32_t *)buf);
if (r) {
result = r;
amdgpu_virt_disable_access_debugfs(adev);
goto err;
}
......@@ -976,10 +976,13 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf,
size -= 4;
}
err:
kfree(data);
amdgpu_virt_disable_access_debugfs(adev);
return result;
err:
kfree(data);
return r;
}
/**
......
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