2022-06-20 10:14:34

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/gem: remove unused assignments

On Mon, 20 Jun 2022, [email protected] wrote:
> From: katrinzhou <[email protected]>
>
> The variable ret is reassigned and the value EINVAL is never used.
> Thus, remove the unused assignments.

It's obviously a bug, but it's not obvious just throwing the code away
is the fix. Maybe there's a missing "else" instead.

BR,
Jani.


>
> Addresses-Coverity: ("Unused value")
> Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)")
> Signed-off-by: katrinzhou <[email protected]>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index ab4c5ab28e4d..d5ef5243673a 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -931,8 +931,6 @@ static int set_proto_ctx_param(struct drm_i915_file_private *fpriv,
> break;
>
> case I915_CONTEXT_PARAM_PERSISTENCE:
> - if (args->size)
> - ret = -EINVAL;
> ret = proto_context_set_persistence(fpriv->dev_priv, pc,
> args->value);
> break;

--
Jani Nikula, Intel Open Source Graphics Center


2022-06-21 02:43:36

by Katrin Jo

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/gem: remove unused assignments

On Mon, Jun 20, 2022 at 6:13 PM Jani Nikula <[email protected]> wrote:
>
> On Mon, 20 Jun 2022, [email protected] wrote:
> > From: katrinzhou <[email protected]>
> >
> > The variable ret is reassigned and the value EINVAL is never used.
> > Thus, remove the unused assignments.
>
> It's obviously a bug, but it's not obvious just throwing the code away
> is the fix. Maybe there's a missing "else" instead.
>
> BR,
> Jani.
>
>
> >
> > Addresses-Coverity: ("Unused value")
> > Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)")
> > Signed-off-by: katrinzhou <[email protected]>
> > ---
> > drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > index ab4c5ab28e4d..d5ef5243673a 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> > @@ -931,8 +931,6 @@ static int set_proto_ctx_param(struct drm_i915_file_private *fpriv,
> > break;
> >
> > case I915_CONTEXT_PARAM_PERSISTENCE:
> > - if (args->size)
> > - ret = -EINVAL;
> > ret = proto_context_set_persistence(fpriv->dev_priv, pc,
> > args->value);
> > break;
>
> --
> Jani Nikula, Intel Open Source Graphics Center

Thanks for reviewing!

Best Regards,
Katrin