Re: [PATCH v2] drm/sched: Fix passing zero to 'PTR_ERR' warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 29 Oct 2019 14:07:48 -0400
Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx> wrote:

> Fix a static code checker warning.
> 
> v2: Drop PTR_ERR_OR_ZERO.
> 
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx>
> ---
>  drivers/gpu/drm/scheduler/sched_main.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index f39b97e..dba4390 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -496,8 +496,10 @@ void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched)
>  		fence = sched->ops->run_job(s_job);
>  
>  		if (IS_ERR_OR_NULL(fence)) {
> +			if (IS_ERR(fence))
> +				dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
> +
>  			s_job->s_fence->parent = NULL;
> -			dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
>  		} else {
>  			s_job->s_fence->parent = fence;
>  		}

Don't know if this patch has already been applied, but we can get rid of
the extra indentation level by doing:

		if (IS_ERR(fence)) {
			dma_fence_set_error(&s_fence->finished,
					    PTR_ERR(fence));
			fence = NULL;
		}

		s_job->s_fence->parent = fence;
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux