hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
....@@ -45,7 +45,6 @@
4545 struct drm_gem_object *gobj;
4646 struct amdgpu_bo *bo;
4747 unsigned long size;
48
- int r;
4948
5049 gobj = drm_gem_object_lookup(p->filp, data->handle);
5150 if (gobj == NULL)
....@@ -60,23 +59,14 @@
6059 drm_gem_object_put(gobj);
6160
6261 size = amdgpu_bo_size(bo);
63
- if (size != PAGE_SIZE || (data->offset + 8) > size) {
64
- r = -EINVAL;
65
- goto error_unref;
66
- }
62
+ if (size != PAGE_SIZE || data->offset > (size - 8))
63
+ return -EINVAL;
6764
68
- if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) {
69
- r = -EINVAL;
70
- goto error_unref;
71
- }
65
+ if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm))
66
+ return -EINVAL;
7267
7368 *offset = data->offset;
74
-
7569 return 0;
76
-
77
-error_unref:
78
- amdgpu_bo_unref(&bo);
79
- return r;
8070 }
8171
8272 static int amdgpu_cs_bo_handles_chunk(struct amdgpu_cs_parser *p,
....@@ -1517,15 +1507,15 @@
15171507 continue;
15181508
15191509 r = dma_fence_wait_timeout(fence, true, timeout);
1510
+ if (r > 0 && fence->error)
1511
+ r = fence->error;
1512
+
15201513 dma_fence_put(fence);
15211514 if (r < 0)
15221515 return r;
15231516
15241517 if (r == 0)
15251518 break;
1526
-
1527
- if (fence->error)
1528
- return fence->error;
15291519 }
15301520
15311521 memset(wait, 0, sizeof(*wait));