File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ vma_create(struct drm_i915_gem_object *obj,
104
104
struct i915_address_space * vm ,
105
105
const struct i915_ggtt_view * view )
106
106
{
107
+ struct i915_vma * pos = ERR_PTR (- E2BIG );
107
108
struct i915_vma * vma ;
108
109
struct rb_node * rb , * * p ;
109
110
@@ -184,7 +185,6 @@ vma_create(struct drm_i915_gem_object *obj,
184
185
rb = NULL ;
185
186
p = & obj -> vma .tree .rb_node ;
186
187
while (* p ) {
187
- struct i915_vma * pos ;
188
188
long cmp ;
189
189
190
190
rb = * p ;
@@ -196,17 +196,12 @@ vma_create(struct drm_i915_gem_object *obj,
196
196
* and dispose of ours.
197
197
*/
198
198
cmp = i915_vma_compare (pos , vm , view );
199
- if (cmp == 0 ) {
200
- spin_unlock (& obj -> vma .lock );
201
- i915_vm_put (vm );
202
- i915_vma_free (vma );
203
- return pos ;
204
- }
205
-
206
199
if (cmp < 0 )
207
200
p = & rb -> rb_right ;
208
- else
201
+ else if ( cmp > 0 )
209
202
p = & rb -> rb_left ;
203
+ else
204
+ goto err_unlock ;
210
205
}
211
206
rb_link_node (& vma -> obj_node , rb , p );
212
207
rb_insert_color (& vma -> obj_node , & obj -> vma .tree );
@@ -229,8 +224,9 @@ vma_create(struct drm_i915_gem_object *obj,
229
224
err_unlock :
230
225
spin_unlock (& obj -> vma .lock );
231
226
err_vma :
227
+ i915_vm_put (vm );
232
228
i915_vma_free (vma );
233
- return ERR_PTR ( - E2BIG ) ;
229
+ return pos ;
234
230
}
235
231
236
232
static struct i915_vma *
You can’t perform that action at this time.
0 commit comments