[PATCH 2/2] drm/amdgpu: fix dereferencing null pointer warning in ring_test_ib()

2024-06-07 Thread Bob Zhou
To avoid null pointer dereference, Check return value and conduct error handling. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 2 ++ drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 4 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 4

[PATCH 1/2] drm/amdgpu: fix overflowed constant warning in mmhub_set_clockgating()

2024-06-07 Thread Bob Zhou
To fix potential overflowed constant warning, modify the variables to u32 for getting the return value of RREG32_SOC15(). Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/mmhub_v1_7.c | 2 +- drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c | 2

[PATCH v2] drm/amdgpu: fix the overflowed constant warning for RREG32_SOC15()

2024-06-04 Thread Bob Zhou
To fix potential overflowed constant warning reported by Coverity, modify the variables to uint32_t. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/imu_v12_0.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/imu_v12_0.c b/drivers

[PATCH] drm/amdgpu: replace int with unsigned int for imu_v12_0.c

2024-06-02 Thread Bob Zhou
The return value of RREG32_SOC15 is unsigned int, so modify variable to unsigned. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/imu_v12_0.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/imu_v12_0.c b/drivers/gpu/drm/amd/amdgpu

[PATCH v2] drm/amd/pm: add missing error handling in function smu_v13_0_6_allocate_dpm_context

2024-05-31 Thread Bob Zhou
Check return value to avoid null pointer dereference. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13

[PATCH] drm/amd/pm: add missing error handling in function smu_v13_0_6_allocate_dpm_context

2024-05-31 Thread Bob Zhou
Check return value to avoid null pointer dereference. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13

[PATCH v3] drm/amd/pm: Fix the null pointer dereference for vega10_hwmgr

2024-05-31 Thread Bob Zhou
Check return value and conduct null pointer handling to avoid null pointer dereference. Signed-off-by: Bob Zhou --- .../drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 29 --- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr

[PATCH v2] drm/amd/pm: Fix the null pointer dereference for vega10_hwmgr

2024-05-31 Thread Bob Zhou
Check return value and conduct null pointer handling to avoid null pointer dereference. Signed-off-by: Bob Zhou --- .../drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b

[PATCH] drm/amd/pm: Fix the null pointer dereference for vega10_hwmgr

2024-05-29 Thread Bob Zhou
Check return value and conduct null pointer handling to avoid null pointer dereference. Signed-off-by: Bob Zhou --- .../drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 38 +++ 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr

[PATCH] drm/amd/pm: add return check for cast_const_phw_vega10_power_state

2024-05-16 Thread Bob Zhou
To avoid null pointer dereference, add return check and handle null pointer. Signed-off-by: Bob Zhou --- .../drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 28 +-- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c

[PATCH v3] drm/amdgpu: add return result for amdgpu_i2c_{get/put}_byte

2024-04-24 Thread Bob Zhou
After amdgpu_i2c_get_byte fail, amdgpu_i2c_put_byte shouldn't be conducted to put wrong value. So return and check the i2c transfer result. Signed-off-by: Bob Zhou Suggested-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | 47 +++-- 1 file changed, 28

[PATCH v2] drm/amdgpu: add return result for amdgpu_i2c_{get/put}_byte

2024-04-24 Thread Bob Zhou
After amdgpu_i2c_get_byte fail, amdgpu_i2c_put_byte shouldn't be conducted to put wrong value. So return and check the i2c transfer result. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | 42 +++-- 1 file changed, 26 insertions(+), 16 deletions(-) diff

[PATCH] drm/amdgpu: add error handle to avoid out-of-bounds

2024-04-23 Thread Bob Zhou
if the sdma_v4_0_irq_id_to_seq return -EINVAL, the process should be stop to avoid out-of-bounds read, so directly return -EINVAL. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b

[PATCH 2/2] drm/amdgpu: fix uninitialized variable warning

2024-04-22 Thread Bob Zhou
Because the val isn't initialized, a random variable is set by amdgpu_i2c_put_byte. So fix the uninitialized issue. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b

[PATCH 1/2] drm/amdgpu: fix double free err_addr pointer warnings

2024-04-22 Thread Bob Zhou
In amdgpu_umc_bad_page_polling_timeout, the amdgpu_umc_handle_bad_pages will be run many times so that double free err_addr in some special case. So set the err_addr to NULL to avoid the warnings. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 1 + 1 file changed, 1

[PATCH 1/2] drm/amdgpu: fix double free err_addr pointer warnings

2024-04-22 Thread Bob Zhou
In amdgpu_umc_bad_page_polling_timeout, the amdgpu_umc_handle_bad_pages will be run many times so that double free err_addr in some special case. So set the err_addr to NULL to avoid the warnings. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 1 + 1 file changed, 1

[PATCH] drm/amdgpu: fix check order ras->in_recovery is earlier than ras feature

2023-10-27 Thread Bob Zhou
x97/0xe0 [amdgpu] Fixes: be5c7eb10406 ("drm/amdgpu: bypass RAS error reset in some conditions") Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/dr

[PATCH] drm/amd/display: add missing NULL check for DML2

2023-10-09 Thread Bob Zhou
/0x2c0 [amdgpu] dc_create+0x23f/0x6b0 [amdgpu] ? dmi_matches+0xa3/0x200 amdgpu_dm_init+0x2bd/0x22a0 [amdgpu] Fixes: a2815ada8616 ("drm/amd/display: Introduce DML2") Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH] drm/amd/display: Fix null pointer for res_pool->hubbub

2023-09-20 Thread Bob Zhou
;) Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index a93db60fe4d9..9cc7a001f9a1 100644

[PATCH V2] drm/amdgpu: remove redundant variable declaration

2023-07-24 Thread Bob Zhou
info in amdgpu_bo_print_info") Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 5ac7544cc068..3f98174fb764 100644 --- a/drivers/gpu/drm/

[PATCH] drm/amdgpu: remove repeat variable domain

2023-07-24 Thread Bob Zhou
building with gcc and W=1 reports drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:1618:15: error: unused variable 'domain' [-Werror=unused-variable] unsigned int domain; ^~ The variable domain is repeated, so remove it. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu

[PATCH] drm/amd: remove repeat code for mes_add_queue_pkt

2023-07-23 Thread Bob Zhou
The setting of mes_add_queue_pkt is repeat, so remove it. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c index 8e67e965f7ea..e806331fee42

[PATCH v2] drm/amdgpu: skip force complete fences when ring is uninitialized

2023-05-31 Thread Bob Zhou
20 [amdgpu] uvd_v7_0_sw_init+0x358/0x450 [amdgpu] amdgpu_device_init.cold+0x198c/0x1fdf [amdgpu] ? pci_bus_read_config_byte+0x40/0x80 ? pci_read_config_byte+0x27/0x50 amdgpu_driver_load_kms+0x1a/0x160 [amdgpu] amdgpu_pci_probe+0x186/0x3c0 [amdgpu] Signed-off-by: Bob Zhou --- drivers/gpu/drm/

[PATCH] drm/amdgpu: skip force complete fences when ring is uninitialized

2023-05-30 Thread Bob Zhou
20 [amdgpu] uvd_v7_0_sw_init+0x358/0x450 [amdgpu] amdgpu_device_init.cold+0x198c/0x1fdf [amdgpu] ? pci_bus_read_config_byte+0x40/0x80 ? pci_read_config_byte+0x27/0x50 amdgpu_driver_load_kms+0x1a/0x160 [amdgpu] amdgpu_pci_probe+0x186/0x3c0 [amdgpu] Signed-off-by: Bob Zhou --- drivers/gpu/drm/

[PATCH] drm/amdxcp: fix Makefile to build amdxcp module

2023-05-30 Thread Bob Zhou
After drm conduct amdgpu Makefile, amdgpu.ko has been created and "amdgpu-y +=" in amdxcp Makefile isn't used. So modify amdgpu-y to amdxcp-y and build amdxcp module. Signed-off-by: Bob Zhou --- drivers/gpu/drm/amd/amdxcp/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletion