diff options
author | Tom Rix <trix@redhat.com> | 2022-02-14 10:22:24 -0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2022-02-16 16:44:40 -0500 |
commit | eed1a5c74216907f79f7b1af725e570e95bab0ea (patch) | |
tree | 08e1b89e20edad2f3276d21426eb13d18069e968 | |
parent | 783782a52340e850840c11d823b649e6ba83a700 (diff) |
drm/amdgpu: check return status before using stable_pstate
Clang static analysis reports this problem
amdgpu_ctx.c:616:26: warning: Assigned value is garbage
or undefined
args->out.pstate.flags = stable_pstate;
^ ~~~~~~~~~~~~~
amdgpu_ctx_stable_pstate can fail without setting
stable_pstate. So check.
Fixes: 8cda7a4f96e4 ("drm/amdgpu/UAPI: add new CTX OP to get/set stable pstates")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index 1c72f6095f08..f522b52725e4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -613,7 +613,8 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, if (args->in.flags) return -EINVAL; r = amdgpu_ctx_stable_pstate(adev, fpriv, id, false, &stable_pstate); - args->out.pstate.flags = stable_pstate; + if (!r) + args->out.pstate.flags = stable_pstate; break; case AMDGPU_CTX_OP_SET_STABLE_PSTATE: if (args->in.flags & ~AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK) |