drm/amdgpu: remove redundant null check
authorWeiguo Li <liwg06@foxmail.com>
Wed, 2 Mar 2022 16:17:39 +0000 (00:17 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 2 Mar 2022 23:40:07 +0000 (18:40 -0500)
Remove the redundant null check since the caller ensures
that 'ctx' is never NULL.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

index 4294f17..2d2dcea 100644 (file)
@@ -262,9 +262,6 @@ static int amdgpu_ctx_get_stable_pstate(struct amdgpu_ctx *ctx,
        struct amdgpu_device *adev = ctx->adev;
        enum amd_dpm_forced_level current_level;
 
-       if (!ctx)
-               return -EINVAL;
-
        current_level = amdgpu_dpm_get_performance_level(adev);
 
        switch (current_level) {
@@ -294,9 +291,6 @@ static int amdgpu_ctx_set_stable_pstate(struct amdgpu_ctx *ctx,
        enum amd_dpm_forced_level level;
        int r;
 
-       if (!ctx)
-               return -EINVAL;
-
        mutex_lock(&adev->pm.stable_pstate_ctx_lock);
        if (adev->pm.stable_pstate_ctx && adev->pm.stable_pstate_ctx != ctx) {
                r = -EBUSY;