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

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

 



On Tue, Oct 29, 2019 at 11:04:44AM -0400, Andrey Grodzovsky wrote:
> Fix a static code checker warning.
> 
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx>
> ---
>  drivers/gpu/drm/scheduler/sched_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index f39b97e..898b0c9 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -497,7 +497,7 @@ void drm_sched_resubmit_jobs(struct drm_gpu_scheduler *sched)
>  
>  		if (IS_ERR_OR_NULL(fence)) {
>  			s_job->s_fence->parent = NULL;
> -			dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
> +			dma_fence_set_error(&s_fence->finished, PTR_ERR_OR_ZERO(fence));

This will silence the static checker warning, but it will still trigger
a WARN_ON().  And it sort of has inspired me to generate a new warning
because that's not how PTR_ERR_OR_ZERO() is supposed to be used.  :P

PTR_ERR_OR_ZERO() is short hand for this situation:

-	if (IS_ERR(fence))
-		return PTR_ERR(fence);
-	return 0;
+	return PTR_ERR_OR_ZERO(fence);

regards,
dan carpenter


_______________________________________________
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