RE: [PATCH] drm/amdgpu: Fix smatch static checker warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - AMD Internal Distribution Only]

Seems only need to deal with this on gfx v11, for gfx v12, it will judgement whether (adev->gfx.imu.funcs && (amdgpu_dpm > 0)) before use imu funcs on gfx_v12_0_rlc_backdoor_autoload_enable.

Regards,
Likun

-----Original Message-----
From: Hawking Zhang <Hawking.Zhang@xxxxxxx>
Sent: Friday, June 21, 2024 3:56 PM
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx; Gao, Likun <Likun.Gao@xxxxxxx>; Min, Frank <Frank.Min@xxxxxxx>
Cc: Zhang, Hawking <Hawking.Zhang@xxxxxxx>
Subject: [PATCH] drm/amdgpu: Fix smatch static checker warning

adev->gfx.imu.funcs could be NULL.

Signed-off-by: Hawking Zhang <Hawking.Zhang@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 8 ++++----  drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index b4575765d7a8..5c17409439f8 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -4498,11 +4498,11 @@ static int gfx_v11_0_hw_init(void *handle)
                        /* RLC autoload sequence 1: Program rlc ram */
                        if (adev->gfx.imu.funcs->program_rlc_ram)
                                adev->gfx.imu.funcs->program_rlc_ram(adev);
+                       /* rlc autoload firmware */
+                       r = gfx_v11_0_rlc_backdoor_autoload_enable(adev);
+                       if (r)
+                               return r;
                }
-               /* rlc autoload firmware */
-               r = gfx_v11_0_rlc_backdoor_autoload_enable(adev);
-               if (r)
-                       return r;
        } else {
                if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
                        if (adev->gfx.imu.funcs && (amdgpu_dpm > 0)) { diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index 460bf33a22b1..16fc5c5b15f5 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -3258,11 +3258,11 @@ static int gfx_v12_0_hw_init(void *handle)
                        /* RLC autoload sequence 1: Program rlc ram */
                        if (adev->gfx.imu.funcs->program_rlc_ram)
                                adev->gfx.imu.funcs->program_rlc_ram(adev);
+                       /* rlc autoload firmware */
+                       r = gfx_v12_0_rlc_backdoor_autoload_enable(adev);
+                       if (r)
+                               return r;
                }
-               /* rlc autoload firmware */
-               r = gfx_v12_0_rlc_backdoor_autoload_enable(adev);
-               if (r)
-                       return r;
        } else {
                if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
                        if (adev->gfx.imu.funcs && (amdgpu_dpm > 0)) {
--
2.17.1





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux