diff mbox series

drm/i915/gem: remove unused assignments

Message ID 20220620100216.1791284-1-zys.zljxml@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/gem: remove unused assignments | expand

Commit Message

Katrin Jo June 20, 2022, 10:02 a.m. UTC
From: katrinzhou <katrinzhou@tencent.com>

The variable ret is reassigned and the value EINVAL is never used.
Thus, remove the unused assignments.

Addresses-Coverity: ("Unused value")
Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)")
Signed-off-by: katrinzhou <katrinzhou@tencent.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Katrin Jo June 21, 2022, 2:21 a.m. UTC | #1
On Mon, Jun 20, 2022 at 6:13 PM Jani Nikula <jani.nikula@linux.intel.com> wrote:
>
> On Mon, 20 Jun 2022, zys.zljxml@gmail.com wrote:
> > From: katrinzhou <katrinzhou@tencent.com>
> >
> > 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 <katrinzhou@tencent.com>
> > ---
> >  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
Tvrtko Ursulin June 22, 2022, 6:52 a.m. UTC | #2
On 21/06/2022 03:26, Katrin Jo wrote:
> On Mon, Jun 20, 2022 at 6:19 PM Tvrtko Ursulin
> <tvrtko.ursulin@linux.intel.com> wrote:
>>
>>
>> On 20/06/2022 11:02, zys.zljxml@gmail.com wrote:
>>> From: katrinzhou <katrinzhou@tencent.com>
>>>
>>> The variable ret is reassigned and the value EINVAL is never used.
>>> Thus, remove the unused assignments.
>>>
>>> Addresses-Coverity: ("Unused value")
>>> Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)")
>>> Signed-off-by: katrinzhou <katrinzhou@tencent.com>
>>> ---
>>>    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);
>>
>> AFAICT fix should end up with code like this:
>>
>> if (args->size)
>>          ret = -EINVAL;
>> else
>>          ret = proto_context_set_persistence(...)
>> break;
>>
>>
>> Alternatively move args->size checking into
>> proto_context_set_persistence to align with set_persistence().
>>
>> Regards,
>>
>> Tvrtko
>>
>>>                break;
> 
> Thanks for reviewing! I sent the V2 patch, modified according to your
> suggestion.

I have merged the v2 to drm-intel-gt-next - thanks for the fix!

Regards,

Tvrtko
diff mbox series

Patch

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;