Re: [PATCH] drm/amdgpu: Fix resource leaks

From: kernel test robot

Date: Wed Feb 25 2026 - 01:42:17 EST


Hi Ethan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v7.0-rc1 next-20260224]
[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/Ethan-Tidmore/drm-amdgpu-Fix-resource-leaks/20260225-095342
base: https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
patch link: https://lore.kernel.org/r/20260225014425.2474802-1-ethantidmore06%40gmail.com
patch subject: [PATCH] drm/amdgpu: Fix resource leaks
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260225/202602251459.1jr0PuUf-lkp@xxxxxxxxx/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260225/202602251459.1jr0PuUf-lkp@xxxxxxxxx/reproduce)

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602251459.1jr0PuUf-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c: In function 'amdgpu_device_fini_sw':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:4942:16: warning: unused variable 'idx' [-Wunused-variable]
4942 | int i, idx;
| ^~~


vim +/idx +4942 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

72c8c97b1522ce Andrey Grodzovsky 2021-05-12 4939
72c8c97b1522ce Andrey Grodzovsky 2021-05-12 4940 void amdgpu_device_fini_sw(struct amdgpu_device *adev)
72c8c97b1522ce Andrey Grodzovsky 2021-05-12 4941 {
bd22e44ad415ac Christian König 2025-01-15 @4942 int i, idx;
d37a3929ca0363 Orlando Chamberlain 2023-03-03 4943 bool px;
62d5f9f7110ad3 Leslie Shi 2022-01-05 4944
a5c5d8d50ecf58 Lang Yu 2021-10-21 4945 amdgpu_device_ip_fini(adev);
b61badd20b443e Vitaly Prosyak 2024-11-11 4946 amdgpu_fence_driver_sw_fini(adev);
b31d306378d9ba Mario Limonciello 2023-01-04 4947 amdgpu_ucode_release(&adev->firmware.gpu_info_fw);
d38ceaf99ed015 Alex Deucher 2015-04-20 4948 adev->accel_working = false;
68ce8b24224265 Christian König 2022-03-02 4949 dma_fence_put(rcu_dereference_protected(adev->gang_submit, true));
bd22e44ad415ac Christian König 2025-01-15 4950 for (i = 0; i < MAX_XCP; ++i) {
bd22e44ad415ac Christian König 2025-01-15 4951 dma_fence_put(adev->isolation[i].spearhead);
bd22e44ad415ac Christian König 2025-01-15 4952 amdgpu_sync_free(&adev->isolation[i].active);
bd22e44ad415ac Christian König 2025-01-15 4953 amdgpu_sync_free(&adev->isolation[i].prev);
bd22e44ad415ac Christian König 2025-01-15 4954 }
04442bf70debb1 Lijo Lazar 2021-03-16 4955
04442bf70debb1 Lijo Lazar 2021-03-16 4956 amdgpu_reset_fini(adev);
04442bf70debb1 Lijo Lazar 2021-03-16 4957
d38ceaf99ed015 Alex Deucher 2015-04-20 4958 /* free i2c buses */
d38ceaf99ed015 Alex Deucher 2015-04-20 4959 amdgpu_i2c_fini(adev);
bfca02892773d2 Shaoyun Liu 2018-02-01 4960
6e8ca38ebc9b13 Lijo Lazar 2025-02-05 4961 if (adev->bios) {
bfca02892773d2 Shaoyun Liu 2018-02-01 4962 if (amdgpu_emu_mode != 1)
d38ceaf99ed015 Alex Deucher 2015-04-20 4963 amdgpu_atombios_fini(adev);
e986e89659e18b Lijo Lazar 2025-02-05 4964 amdgpu_bios_release(adev);
6e8ca38ebc9b13 Lijo Lazar 2025-02-05 4965 }
d37a3929ca0363 Orlando Chamberlain 2023-03-03 4966
8a2b51392ac4a5 Lijo Lazar 2023-10-04 4967 kfree(adev->fru_info);
8a2b51392ac4a5 Lijo Lazar 2023-10-04 4968 adev->fru_info = NULL;
8a2b51392ac4a5 Lijo Lazar 2023-10-04 4969
b5aaa82e2b12fe Flora Cui 2025-03-14 4970 kfree(adev->xcp_mgr);
b5aaa82e2b12fe Flora Cui 2025-03-14 4971 adev->xcp_mgr = NULL;
b5aaa82e2b12fe Flora Cui 2025-03-14 4972
127ed492ad2df0 Lijo Lazar 2025-06-30 4973 px = amdgpu_device_supports_px(adev);
d37a3929ca0363 Orlando Chamberlain 2023-03-03 4974
7b1c6263eaf4fd Alex Deucher 2023-10-17 4975 if (px || (!dev_is_removable(&adev->pdev->dev) &&
d37a3929ca0363 Orlando Chamberlain 2023-03-03 4976 apple_gmux_detect(NULL, NULL)))
d38ceaf99ed015 Alex Deucher 2015-04-20 4977 vga_switcheroo_unregister_client(adev->pdev);
d37a3929ca0363 Orlando Chamberlain 2023-03-03 4978
d37a3929ca0363 Orlando Chamberlain 2023-03-03 4979 if (px)
83ba126a9be318 Alex Deucher 2016-06-03 4980 vga_switcheroo_fini_domain_pm_ops(adev->dev);
d37a3929ca0363 Orlando Chamberlain 2023-03-03 4981
38d6be8199331e Alex Deucher 2020-11-20 4982 if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
b8779475869a26 Christoph Hellwig 2021-07-16 4983 vga_client_unregister(adev->pdev);
e9bc1bf7916e00 Yintian Tao 2019-06-05 4984
d155bef0636e01 Arnd Bergmann 2019-07-08 4985 if (IS_ENABLED(CONFIG_PERF_EVENTS))
9c7c85f7ea1fe5 Jonathan Kim 2019-06-19 4986 amdgpu_pmu_fini(adev);
9e2096baab9add Lijo Lazar 2025-10-10 4987 if (adev->discovery.bin)
a190d1c75c73ce Xiaojie Yuan 2019-03-27 4988 amdgpu_discovery_fini(adev);
72c8c97b1522ce Andrey Grodzovsky 2021-05-12 4989
cfbb6b0047448e Andrey Grodzovsky 2022-01-21 4990 amdgpu_reset_put_reset_domain(adev->reset_domain);
cfbb6b0047448e Andrey Grodzovsky 2022-01-21 4991 adev->reset_domain = NULL;
cfbb6b0047448e Andrey Grodzovsky 2022-01-21 4992
72c8c97b1522ce Andrey Grodzovsky 2021-05-12 4993 kfree(adev->pci_state);
1dd2fa0e00f17b Lijo Lazar 2025-06-28 4994 kfree(adev->pcie_reset_ctx.swds_pcistate);
1dd2fa0e00f17b Lijo Lazar 2025-06-28 4995 kfree(adev->pcie_reset_ctx.swus_pcistate);
d38ceaf99ed015 Alex Deucher 2015-04-20 4996 }
d38ceaf99ed015 Alex Deucher 2015-04-20 4997

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki