.. | .. |
---|
45 | 45 | struct drm_gem_object *gobj; |
---|
46 | 46 | struct amdgpu_bo *bo; |
---|
47 | 47 | unsigned long size; |
---|
48 | | - int r; |
---|
49 | 48 | |
---|
50 | 49 | gobj = drm_gem_object_lookup(p->filp, data->handle); |
---|
51 | 50 | if (gobj == NULL) |
---|
.. | .. |
---|
60 | 59 | drm_gem_object_put(gobj); |
---|
61 | 60 | |
---|
62 | 61 | 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; |
---|
67 | 64 | |
---|
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; |
---|
72 | 67 | |
---|
73 | 68 | *offset = data->offset; |
---|
74 | | - |
---|
75 | 69 | return 0; |
---|
76 | | - |
---|
77 | | -error_unref: |
---|
78 | | - amdgpu_bo_unref(&bo); |
---|
79 | | - return r; |
---|
80 | 70 | } |
---|
81 | 71 | |
---|
82 | 72 | static int amdgpu_cs_bo_handles_chunk(struct amdgpu_cs_parser *p, |
---|
.. | .. |
---|
1517 | 1507 | continue; |
---|
1518 | 1508 | |
---|
1519 | 1509 | r = dma_fence_wait_timeout(fence, true, timeout); |
---|
| 1510 | + if (r > 0 && fence->error) |
---|
| 1511 | + r = fence->error; |
---|
| 1512 | + |
---|
1520 | 1513 | dma_fence_put(fence); |
---|
1521 | 1514 | if (r < 0) |
---|
1522 | 1515 | return r; |
---|
1523 | 1516 | |
---|
1524 | 1517 | if (r == 0) |
---|
1525 | 1518 | break; |
---|
1526 | | - |
---|
1527 | | - if (fence->error) |
---|
1528 | | - return fence->error; |
---|
1529 | 1519 | } |
---|
1530 | 1520 | |
---|
1531 | 1521 | memset(wait, 0, sizeof(*wait)); |
---|