drm/amdgpu: fix a smatch static checker warning in amdgpu_pci_slot_reset
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 drm/amdgpu: fix a smatch static checker warning in amdgpu_pci_slot_reset
Fixes smatch warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:6820 amdgpu_pci_slot_reset()
warn: iterator used outside loop: 'tmp_adev'
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -6846,7 +6846,7 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev)dev_info (adev->dev,"PCIe error recovery succeeded\n" ); }else {dev_err (adev->dev,"PCIe error recovery failed, err:%d\n" , r); -if (tmp_adev) { +if (hive) {list_for_each_entry (tmp_adev, &device_list, reset_list)amdgpu_device_unset_mp1_state (tmp_adev);amdgpu_device_unlock_reset_domain (adev->reset_domain);
Signature · 1 line
2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
Quoted 37 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Ce Sun
Sent: Wednesday, April 9, 2025 8:10 PM
To: [email protected]
Cc: [email protected]; Sun, Ce(Overlord) <[email protected]>
Subject: [PATCH v1 1/1] drm/amdgpu: fix a smatch static checker warning inamdgpu_pci_slot_resetFixes smatch warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:6820amdgpu_pci_slot_reset()
warn: iterator used outside loop: 'tmp_adev'Fixes 8ba904f54148 ("drm/amdgpu: Multi-GPU DPC recovery support")Signed-off-by Ce Sun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -6846,7 +6846,7 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev)dev_info (adev->dev,"PCIe error recovery succeeded\n" ); }else {dev_err (adev->dev,"PCIe error recovery failed, err:%d\n" , r); -if (tmp_adev) { +if (hive) {list_for_each_entry (tmp_adev, &device_list, reset_list)amdgpu_device_unset_mp1_state (tmp_adev);amdgpu_device_unlock_reset_domain(adev->reset_domain);--
2.34.1
Quoted 17 lines · Ce Sun
Fixes smatch warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:6820amdgpu_pci_slot_reset()
warn: iterator used outside loop: 'tmp_adev'Fixes 8ba904f54148 ("drm/amdgpu: Multi-GPU DPC recovery support")Signed-off-by Ce Sun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev) · line 6849
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -6846,7 +6846,7 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev)dev_info (adev->dev,"PCIe error recovery succeeded\n" ); }else {dev_err (adev->dev,"PCIe error recovery failed, err:%d\n" , r); -if (tmp_adev) { +if (hive) {
Hi Ce Sun,
Looks like your original patch broke single device handling path. That one will need a revisit.
Thanks,
Lijo
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0list_for_each_entry (tmp_adev, &device_list, reset_list)amdgpu_device_unset_mp1_state (tmp_adev);amdgpu_device_unlock_reset_domain (adev->reset_domain);
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Lijo,
There is indeed a single device issue, thank you very much
Thanks,
Sun,Ce
________________________________
From: Lazar, Lijo <[email protected]>
Sent: Thursday, April 10, 2025 4:11 PM
To: Sun, Ce(Overlord) <[email protected]>; [email protected] <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: [PATCH v1 1/1] drm/amdgpu: fix a smatch static checker warning in amdgpu_pci_slot_reset
Quoted 17 lines · Ce Sun
Fixes smatch warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:6820amdgpu_pci_slot_reset()
warn: iterator used outside loop: 'tmp_adev'Fixes 8ba904f54148 ("drm/amdgpu: Multi-GPU DPC recovery support")Signed-off-by Ce Sun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev) · line 6849
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -6846,7 +6846,7 @@ pci_ers_result_t amdgpu_pci_slot_reset(struct pci_dev *pdev)dev_info (adev->dev,"PCIe error recovery succeeded\n" ); }else {dev_err (adev->dev,"PCIe error recovery failed, err:%d\n" , r); -if (tmp_adev) { +if (hive) {
Hi Ce Sun,
Looks like your original patch broke single device handling path. That one will need a revisit.
Thanks,
Lijo
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0list_for_each_entry (tmp_adev, &device_list, reset_list)amdgpu_device_unset_mp1_state (tmp_adev);amdgpu_device_unlock_reset_domain (adev->reset_domain);
Quoted 7 lines · Ce Sun
Fixes smatch warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:6820amdgpu_pci_slot_reset()
warn: iterator used outside loop: 'tmp_adev'Fixes 8ba904f54148 ("drm/amdgpu: Multi-GPU DPC recovery support")
Thanks. This doesn't change how the code works so probably the Fixes tag isn't required. But it doesn't hurt anything either. Static checker warnings are a gray area.
regards,
dan carpenter