2021-10-25 11:52:11

by Jiabing Wan

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

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 <[email protected]>
---
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;
}
--
2.20.1


2021-10-25 19:08:16

by Matthew Auld

[permalink] [raw]
Subject: Re: [PATCH] drm/i915: Use ERR_CAST instead of ERR_PTR(PTR_ERR())

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 <[email protected]>

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;
> }
>