The function amdgpu_ras_error_data_init() always returns 0, making its return value checks redundant. This patch changes its return type to void and removes all unnecessary checks in the callers.
This simplifies the code and avoids confusion about the function's behavior. Additionally, this change keeps the usage consistent with amdgpu_ras_do_page_retirement(), which also does not check the return value.
Fixes: 5b1270beb380 ("drm/amdgpu: add ras_err_info to identify RAS error source") Cc: stable@vger.kernel.org # 6.7+ Signed-off-by: Wentao Liang vulab@iscas.ac.cn --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 19 +++++-------------- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 8 ++------ drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 3 +-- drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c | 3 +-- 5 files changed, 10 insertions(+), 25 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 4c9fa24dd972..aef1b2b713a2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -182,9 +182,7 @@ static int amdgpu_reserve_page_direct(struct amdgpu_device *adev, uint64_t addre return 0; }
- ret = amdgpu_ras_error_data_init(&err_data); - if (ret) - return ret; + amdgpu_ras_error_data_init(&err_data);
memset(&err_rec, 0x0, sizeof(struct eeprom_table_record)); err_data.err_addr = &err_rec; @@ -687,8 +685,7 @@ static struct ras_manager *amdgpu_ras_create_obj(struct amdgpu_device *adev, if (alive_obj(obj)) return NULL;
- if (amdgpu_ras_error_data_init(&obj->err_data)) - return NULL; + amdgpu_ras_error_data_init(&obj->err_data)
obj->head = *head; obj->adev = adev; @@ -1428,9 +1425,7 @@ static int amdgpu_ras_query_error_status_with_event(struct amdgpu_device *adev, if (!obj) return -EINVAL;
- ret = amdgpu_ras_error_data_init(&err_data); - if (ret) - return ret; + amdgpu_ras_error_data_init(&err_data);
if (!amdgpu_ras_get_error_query_mode(adev, &error_query_mode)) return -EINVAL; @@ -2255,9 +2250,7 @@ static void amdgpu_ras_interrupt_umc_handler(struct ras_manager *obj, if (!data->cb) return;
- ret = amdgpu_ras_error_data_init(&err_data); - if (ret) - return; + amdgpu_ras_error_data_init(&err_data);
/* Let IP handle its data, maybe we need get the output * from the callback to update the error type/count, etc @@ -4623,13 +4616,11 @@ void amdgpu_ras_inst_reset_ras_error_count(struct amdgpu_device *adev, } }
-int amdgpu_ras_error_data_init(struct ras_err_data *err_data) +void amdgpu_ras_error_data_init(struct ras_err_data *err_data) { memset(err_data, 0, sizeof(*err_data));
INIT_LIST_HEAD(&err_data->err_node_list); - - return 0; }
static void amdgpu_ras_error_node_release(struct ras_err_node *err_node) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h index 6db772ecfee4..5f88e70fbf5c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h @@ -931,7 +931,7 @@ void amdgpu_ras_inst_reset_ras_error_count(struct amdgpu_device *adev, uint32_t reg_list_size, uint32_t instance);
-int amdgpu_ras_error_data_init(struct ras_err_data *err_data); +void amdgpu_ras_error_data_init(struct ras_err_data *err_data); void amdgpu_ras_error_data_fini(struct ras_err_data *err_data); int amdgpu_ras_error_statistic_ce_count(struct ras_err_data *err_data, struct amdgpu_smuio_mcm_config_info *mcm_info, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c index 896f3609b0ee..5de6e332c2cd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c @@ -52,9 +52,7 @@ int amdgpu_umc_page_retirement_mca(struct amdgpu_device *adev, struct ras_err_data err_data; int ret;
- ret = amdgpu_ras_error_data_init(&err_data); - if (ret) - return ret; + amdgpu_ras_error_data_init(&err_data);
err_data.err_addr = kcalloc(adev->umc.max_ras_err_cnt_per_query, @@ -230,9 +228,7 @@ int amdgpu_umc_pasid_poison_handler(struct amdgpu_device *adev, }; struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head);
- ret = amdgpu_ras_error_data_init(&err_data); - if (ret) - return ret; + amdgpu_ras_error_data_init(&err_data);
ret = amdgpu_umc_do_page_retirement(adev, &err_data, NULL, reset);
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c index a26a9be58eac..d4bdfe280c88 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c @@ -364,8 +364,7 @@ static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_device struct ras_err_data err_data; struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
- if (amdgpu_ras_error_data_init(&err_data)) - return; + amdgpu_ras_error_data_init(&err_data);
if (adev->asic_type == CHIP_ALDEBARAN) bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL_ALDE); diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c index 8a0a63ac88d2..c79ed1adf681 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c @@ -537,8 +537,7 @@ static void nbio_v7_9_handle_ras_controller_intr_no_bifring(struct amdgpu_device struct ras_err_data err_data; struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
- if (amdgpu_ras_error_data_init(&err_data)) - return; + amdgpu_ras_error_data_init(&err_data);
bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL);
Hi Wentao,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-exynos/exynos-drm-next] [also build test ERROR on linus/master v6.15-rc3 next-20250417] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Wentao-Liang/drm-amdgpu-Remov... base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next patch link: https://lore.kernel.org/r/20250422073505.2378-1-vulab%40iscas.ac.cn patch subject: [PATCH RESEND] drm/amdgpu: Remove redundant return value checks for amdgpu_ras_error_data_init config: i386-buildonly-randconfig-005-20250422 (https://download.01.org/0day-ci/archive/20250422/202504221807.hOSkO5OB-lkp@i...) compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250422/202504221807.hOSkO5OB-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202504221807.hOSkO5OB-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:170:6: warning: unused variable 'ret' [-Wunused-variable]
170 | int ret; | ^~~
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:690:44: error: expected ';' after expression
690 | amdgpu_ras_error_data_init(&obj->err_data) | ^ | ; 1 warning and 1 error generated.
vim +690 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
664 665 /* make one obj and return it. */ 666 static struct ras_manager *amdgpu_ras_create_obj(struct amdgpu_device *adev, 667 struct ras_common_if *head) 668 { 669 struct amdgpu_ras *con = amdgpu_ras_get_context(adev); 670 struct ras_manager *obj; 671 672 if (!adev->ras_enabled || !con) 673 return NULL; 674 675 if (head->block >= AMDGPU_RAS_BLOCK_COUNT) 676 return NULL; 677 678 if (head->block == AMDGPU_RAS_BLOCK__MCA) { 679 if (head->sub_block_index >= AMDGPU_RAS_MCA_BLOCK__LAST) 680 return NULL; 681 682 obj = &con->objs[AMDGPU_RAS_BLOCK__LAST + head->sub_block_index]; 683 } else 684 obj = &con->objs[head->block]; 685 686 /* already exist. return obj? */ 687 if (alive_obj(obj)) 688 return NULL; 689
690 amdgpu_ras_error_data_init(&obj->err_data)
691 692 obj->head = *head; 693 obj->adev = adev; 694 list_add(&obj->node, &con->head); 695 get_obj(obj); 696 697 return obj; 698 } 699
Hi Wentao,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-exynos/exynos-drm-next] [also build test ERROR on linus/master drm/drm-next drm-misc/drm-misc-next v6.15-rc3 next-20250422] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Wentao-Liang/drm-amdgpu-Remov... base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next patch link: https://lore.kernel.org/r/20250422073505.2378-1-vulab%40iscas.ac.cn patch subject: [PATCH RESEND] drm/amdgpu: Remove redundant return value checks for amdgpu_ras_error_data_init config: x86_64-buildonly-randconfig-001-20250423 (https://download.01.org/0day-ci/archive/20250423/202504230730.y8eas9Se-lkp@i...) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250423/202504230730.y8eas9Se-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202504230730.y8eas9Se-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c: In function 'amdgpu_reserve_page_direct': drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:170:13: warning: unused variable 'ret' [-Wunused-variable] 170 | int ret; | ^~~ drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c: In function 'amdgpu_ras_create_obj':
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:690:51: error: expected ';' before 'obj'
690 | amdgpu_ras_error_data_init(&obj->err_data) | ^ | ; 691 | 692 | obj->head = *head; | ~~~
vim +690 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
664 665 /* make one obj and return it. */ 666 static struct ras_manager *amdgpu_ras_create_obj(struct amdgpu_device *adev, 667 struct ras_common_if *head) 668 { 669 struct amdgpu_ras *con = amdgpu_ras_get_context(adev); 670 struct ras_manager *obj; 671 672 if (!adev->ras_enabled || !con) 673 return NULL; 674 675 if (head->block >= AMDGPU_RAS_BLOCK_COUNT) 676 return NULL; 677 678 if (head->block == AMDGPU_RAS_BLOCK__MCA) { 679 if (head->sub_block_index >= AMDGPU_RAS_MCA_BLOCK__LAST) 680 return NULL; 681 682 obj = &con->objs[AMDGPU_RAS_BLOCK__LAST + head->sub_block_index]; 683 } else 684 obj = &con->objs[head->block]; 685 686 /* already exist. return obj? */ 687 if (alive_obj(obj)) 688 return NULL; 689
690 amdgpu_ras_error_data_init(&obj->err_data)
691 692 obj->head = *head; 693 obj->adev = adev; 694 list_add(&obj->node, &con->head); 695 get_obj(obj); 696 697 return obj; 698 } 699
linux-stable-mirror@lists.linaro.org