struct vc4_dev *vc4 = to_vc4_dev(dev);
unsigned long irqflags;
u32 i;
- int ret;
+ int ret = 0;
spin_lock_irqsave(&vc4->job_lock, irqflags);
kernel_state = vc4->hang_state;
bo_state[i].size = vc4_bo->base.base.size;
}
- ret = copy_to_user((void __user *)(uintptr_t)get_state->bo,
- bo_state,
- state->bo_count * sizeof(*bo_state));
+ if (copy_to_user((void __user *)(uintptr_t)get_state->bo,
+ bo_state,
+ state->bo_count * sizeof(*bo_state)))
+ ret = -EFAULT;
+
kfree(bo_state);
err_free:
exec->shader_state = temp + exec_size;
exec->shader_state_size = args->shader_rec_count;
- ret = copy_from_user(bin,
- (void __user *)(uintptr_t)args->bin_cl,
- args->bin_cl_size);
- if (ret) {
- DRM_ERROR("Failed to copy in bin cl\n");
+ if (copy_from_user(bin,
+ (void __user *)(uintptr_t)args->bin_cl,
+ args->bin_cl_size)) {
+ ret = -EFAULT;
goto fail;
}
- ret = copy_from_user(exec->shader_rec_u,
- (void __user *)(uintptr_t)args->shader_rec,
- args->shader_rec_size);
- if (ret) {
- DRM_ERROR("Failed to copy in shader recs\n");
+ if (copy_from_user(exec->shader_rec_u,
+ (void __user *)(uintptr_t)args->shader_rec,
+ args->shader_rec_size)) {
+ ret = -EFAULT;
goto fail;
}
- ret = copy_from_user(exec->uniforms_u,
- (void __user *)(uintptr_t)args->uniforms,
- args->uniforms_size);
- if (ret) {
- DRM_ERROR("Failed to copy in uniforms cl\n");
+ if (copy_from_user(exec->uniforms_u,
+ (void __user *)(uintptr_t)args->uniforms,
+ args->uniforms_size)) {
+ ret = -EFAULT;
goto fail;
}