diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c b/drivers/gpu/drm/i915/intel_pipe_crc.c index 647426c..de1bf5f 100644 --- a/drivers/gpu/drm/i915/intel_pipe_crc.c +++ b/drivers/gpu/drm/i915/intel_pipe_crc.c @@ -146,15 +146,13 @@ i915_pipe_crc_read(struct file *filep, char __user *user_buf, size_t count, entry->crc[1], entry->crc[2], entry->crc[3], entry->crc[4]); - spin_unlock_irq(&pipe_crc->lock); - - if (copy_to_user(user_buf, buf, PIPE_CRC_LINE_LEN)) + if (copy_to_user(user_buf, buf, PIPE_CRC_LINE_LEN)) { + spin_unlock_irq(&pipe_crc->lock); return -EFAULT; + } user_buf += PIPE_CRC_LINE_LEN; n_entries--; - - spin_lock_irq(&pipe_crc->lock); } spin_unlock_irq(&pipe_crc->lock);