[PATCH] drm/i915: Use ERR_CAST instead of ERR_PTR(PTR_ERR())

Matthew Auld matthew.auld at intel.com
Mon Oct 25 15:42:24 UTC 2021


On 25/10/2021 12:32, Wan Jiabing wrote:
> Fix following coccicheck warning:
> ./drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:3117:15-22: WARNING:
> ERR_CAST can be used with eb->requests[i].
> 
> Signed-off-by: Wan Jiabing <wanjiabing at vivo.com>

Pushed to drm-intel-gt-next. Thanks.

> ---
>   drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 4d7da07442f2..eb2dcaf78d08 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -3114,7 +3114,7 @@ eb_requests_create(struct i915_execbuffer *eb, struct dma_fence *in_fence,
>   		/* Allocate a request for this batch buffer nice and early. */
>   		eb->requests[i] = i915_request_create(eb_find_context(eb, i));
>   		if (IS_ERR(eb->requests[i])) {
> -			out_fence = ERR_PTR(PTR_ERR(eb->requests[i]));
> +			out_fence = ERR_CAST(eb->requests[i]);
>   			eb->requests[i] = NULL;
>   			return out_fence;
>   		}
> 


More information about the dri-devel mailing list