File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -192,12 +192,16 @@ i915_gem_context_unlock_engines(struct i915_gem_context *ctx)
192
192
static inline struct intel_context *
193
193
i915_gem_context_get_engine (struct i915_gem_context * ctx , unsigned int idx )
194
194
{
195
- struct intel_context * ce = ERR_PTR ( - EINVAL ) ;
195
+ struct intel_context * ce ;
196
196
197
197
rcu_read_lock (); {
198
198
struct i915_gem_engines * e = rcu_dereference (ctx -> engines );
199
- if (likely (idx < e -> num_engines && e -> engines [idx ]))
199
+ if (unlikely (!e )) /* context was closed! */
200
+ ce = ERR_PTR (- ENOENT );
201
+ else if (likely (idx < e -> num_engines && e -> engines [idx ]))
200
202
ce = intel_context_get (e -> engines [idx ]);
203
+ else
204
+ ce = ERR_PTR (- EINVAL );
201
205
} rcu_read_unlock ();
202
206
203
207
return ce ;
You can’t perform that action at this time.
0 commit comments