mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 00:39:48 +00:00
drm/amdgpu: Fix a bug in checking the result of reserve page
Fix if (ret) --> if (!ret), a bug, for "retire_page", which caused the kernel to recall the method with *pos == end of file, and that bounced back with error. On the first run, we advanced *pos, but returned 0 back to fs layer, also a bug. Fix the logic of the check of the result of amdgpu_reserve_page_direct()--it is 0 on success, and non-zero on error, not the other way around. This patch fixes this bug. Cc: Alexander Deucher <Alexander.Deucher@amd.com> Cc: John Clements <john.clements@amd.com> Cc: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Luben Tuikov <luben.tuikov@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
6cb7a1d40a
commit
80b0cd0fb9
1 changed files with 3 additions and 6 deletions
|
@ -114,7 +114,7 @@ static int amdgpu_reserve_page_direct(struct amdgpu_device *adev, uint64_t addre
|
||||||
|
|
||||||
if (amdgpu_ras_check_bad_page(adev, address)) {
|
if (amdgpu_ras_check_bad_page(adev, address)) {
|
||||||
dev_warn(adev->dev,
|
dev_warn(adev->dev,
|
||||||
"RAS WARN: 0x%llx has been marked as bad page!\n",
|
"RAS WARN: 0x%llx has already been marked as bad page!\n",
|
||||||
address);
|
address);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,6 @@ static int amdgpu_ras_debugfs_ctrl_parse_data(struct file *f,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (op != -1) {
|
if (op != -1) {
|
||||||
|
|
||||||
if (op == 3) {
|
if (op == 3) {
|
||||||
if (sscanf(str, "%*s %llx", &address) != 1)
|
if (sscanf(str, "%*s %llx", &address) != 1)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -364,11 +363,9 @@ static ssize_t amdgpu_ras_debugfs_ctrl_write(struct file *f, const char __user *
|
||||||
if (ret)
|
if (ret)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (data.op == 3)
|
if (data.op == 3) {
|
||||||
{
|
|
||||||
ret = amdgpu_reserve_page_direct(adev, data.inject.address);
|
ret = amdgpu_reserve_page_direct(adev, data.inject.address);
|
||||||
|
if (!ret)
|
||||||
if (ret)
|
|
||||||
return size;
|
return size;
|
||||||
else
|
else
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue