[PATCH v2] drm/amdgpu: remove redundant null check

Alex Deucher alexdeucher at gmail.com
Wed Mar 2 18:05:22 UTC 2022


Applied.  Thanks!

Alex

On Wed, Mar 2, 2022 at 11:54 AM Christian König
<ckoenig.leichtzumerken at gmail.com> wrote:
>
> Am 02.03.22 um 17:17 schrieb Weiguo Li:
> > Remove the redundant null check since the caller ensures
> > that 'ctx' is never NULL.
> >
> > Signed-off-by: Weiguo Li <liwg06 at foxmail.com>
>
> Reviewed-by: Christian König <christian.koenig at amd.com>
>
> > ---
> > v2:
> > * take Christian and Alex's suggestion
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 6 ------
> >   1 file changed, 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> > index f522b52725e4..2f38de406937 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> > @@ -261,9 +261,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) {
> > @@ -293,9 +290,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;
>


More information about the amd-gfx mailing list