All of lore.kernel.org
 help / color / mirror / Atom feed
From: Weiguo Li <liwg06@foxmail.com>
To: alexander.deucher@amd.com
Cc: ckoenig.leichtzumerken@gmail.com, amd-gfx@lists.freedesktop.org
Subject: [PATCH v2] drm/amdgpu: remove redundant null check
Date: Thu,  3 Mar 2022 00:17:39 +0800	[thread overview]
Message-ID: <tencent_DD9048474C138FE4294644B7CEEDF7D84806@qq.com> (raw)
In-Reply-To: <CADnq5_Na2UtFUTX5uphZH6THw7PisPM835TLgjB=Ne_3==VJUg@mail.gmail.com>

Remove the redundant null check since the caller ensures
that 'ctx' is never NULL.

Signed-off-by: Weiguo Li <liwg06@foxmail.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;
-- 
2.25.1


  reply	other threads:[~2022-03-02 16:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02  4:35 [PATCH] drm/amdgpu: fix potential null dereference Weiguo Li
2022-03-02 14:21 ` Alex Deucher
2022-03-02 15:01   ` Christian König
2022-03-02 15:39     ` Alex Deucher
2022-03-02 16:17       ` Weiguo Li [this message]
2022-03-02 16:53         ` [PATCH v2] drm/amdgpu: remove redundant null check Christian König
2022-03-02 18:05           ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_DD9048474C138FE4294644B7CEEDF7D84806@qq.com \
    --to=liwg06@foxmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ckoenig.leichtzumerken@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.