Commit 5e6a9471 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Check for error before calling cmpxchg()

Only do the locked compare of the existing fence->error if we actually
need to set an error. As we tend to call i915_sw_fence_set_error_once()
unconditionally, it saves on typing to put the common has-error check
into the inline.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191206160428.1503343-1-chris@chris-wilson.co.uk
parent b66ecd04
...@@ -112,7 +112,8 @@ static inline void i915_sw_fence_wait(struct i915_sw_fence *fence) ...@@ -112,7 +112,8 @@ static inline void i915_sw_fence_wait(struct i915_sw_fence *fence)
static inline void static inline void
i915_sw_fence_set_error_once(struct i915_sw_fence *fence, int error) i915_sw_fence_set_error_once(struct i915_sw_fence *fence, int error)
{ {
cmpxchg(&fence->error, 0, error); if (unlikely(error))
cmpxchg(&fence->error, 0, error);
} }
#endif /* _I915_SW_FENCE_H_ */ #endif /* _I915_SW_FENCE_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment