drm/i915/gem: remove unused assignments
Subsystems (2)
PATCH 1/1 drm/i915/gem: remove unused assignments
From: katrinzhou <[email protected]>
The variable ret is reassigned and the value EINVAL is never used. Thus, remove the unused assignments.
Addresses-Coverity: ("Unused value")
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +0 -2
@@ -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 ;
Signature · 1 line
2.27.0
Jani Nikula
maintainerQuoted 4 lines · 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.
Quoted 21 lines
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(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-2@@ -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 ;
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Quoted 29 lines · Jani Nikula
Quoted 4 lines · 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.Quoted 15 lines
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(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0@@ -931,8 +931,6 @@ static int set_proto_ctx_param(struct drm_i915_file_private *fpriv,break ;
Quoted 9 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c static int set_proto_ctx_param(struct drm_i915_file_private *fpriv, · line 936
Quoted 6 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-2case 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
Quoted 17 lines · On 20/06/2022 11:02, [email protected] wrote:
From: katrinzhou <[email protected]>
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 <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0
drivers/gpu/drm/i915/gem/i915_gem_context.c static int set_proto_ctx_param(struct drm_i915_file_private *fpriv, · line 935
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-2@@ -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
Quoted 1 line
drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0break ;
Quoted 37 lines · Tvrtko Ursulin
Quoted 17 lines · On 20/06/2022 11:02, [email protected] wrote:
From: katrinzhou <[email protected]>
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 <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0drivers/gpu/drm/i915/gem/i915_gem_context.c static int set_proto_ctx_param(struct drm_i915_file_private *fpriv, · line 935
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-2@@ -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;
Quoted 8 lines
Alternatively move
args->sizechecking intoproto_context_set_persistenceto align withset_persistence().Regards,
Tvrtko
Quoted 1 line
drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0break ;
Thanks for reviewing! I sent the V2 patch, modified according to your suggestion.
Best Regards,
Katrin
Quoted 42 lines · Katrin Jo
Quoted 40 lines · Tvrtko Ursulin
Quoted 17 lines · On 20/06/2022 11:02, [email protected] wrote:
From: katrinzhou <[email protected]>
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 <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0drivers/gpu/drm/i915/gem/i915_gem_context.c static int set_proto_ctx_param(struct drm_i915_file_private *fpriv, · line 935
Quoted 7 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-2@@ -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->sizechecking intoproto_context_set_persistenceto align withset_persistence().
Quoted 8 lines
Quoted 5 lines
Regards,
Tvrtko
Quoted 1 line
drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0break ;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