mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
drm/amdgpu: Release hive reference properly
[ Upstream commit c1456fadce ]
xgmi hive reference is taken on function entry, but not released
correctly for all paths. Use __free() to release reference properly.
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Ce Sun <cesun102@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5a577de86c
commit
cfee28ef80
@@ -6880,7 +6880,8 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta
|
|||||||
{
|
{
|
||||||
struct drm_device *dev = pci_get_drvdata(pdev);
|
struct drm_device *dev = pci_get_drvdata(pdev);
|
||||||
struct amdgpu_device *adev = drm_to_adev(dev);
|
struct amdgpu_device *adev = drm_to_adev(dev);
|
||||||
struct amdgpu_hive_info *hive = amdgpu_get_xgmi_hive(adev);
|
struct amdgpu_hive_info *hive __free(xgmi_put_hive) =
|
||||||
|
amdgpu_get_xgmi_hive(adev);
|
||||||
struct amdgpu_reset_context reset_context;
|
struct amdgpu_reset_context reset_context;
|
||||||
struct list_head device_list;
|
struct list_head device_list;
|
||||||
|
|
||||||
@@ -6911,10 +6912,8 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta
|
|||||||
amdgpu_device_recovery_get_reset_lock(adev, &device_list);
|
amdgpu_device_recovery_get_reset_lock(adev, &device_list);
|
||||||
amdgpu_device_halt_activities(adev, NULL, &reset_context, &device_list,
|
amdgpu_device_halt_activities(adev, NULL, &reset_context, &device_list,
|
||||||
hive, false);
|
hive, false);
|
||||||
if (hive) {
|
if (hive)
|
||||||
mutex_unlock(&hive->hive_lock);
|
mutex_unlock(&hive->hive_lock);
|
||||||
amdgpu_put_xgmi_hive(hive);
|
|
||||||
}
|
|
||||||
return PCI_ERS_RESULT_NEED_RESET;
|
return PCI_ERS_RESULT_NEED_RESET;
|
||||||
case pci_channel_io_perm_failure:
|
case pci_channel_io_perm_failure:
|
||||||
/* Permanent error, prepare for device removal */
|
/* Permanent error, prepare for device removal */
|
||||||
|
|||||||
@@ -126,4 +126,8 @@ uint32_t amdgpu_xgmi_get_max_bandwidth(struct amdgpu_device *adev);
|
|||||||
|
|
||||||
void amgpu_xgmi_set_max_speed_width(struct amdgpu_device *adev,
|
void amgpu_xgmi_set_max_speed_width(struct amdgpu_device *adev,
|
||||||
uint16_t max_speed, uint8_t max_width);
|
uint16_t max_speed, uint8_t max_width);
|
||||||
|
|
||||||
|
/* Cleanup macro for use with __free(xgmi_put_hive) */
|
||||||
|
DEFINE_FREE(xgmi_put_hive, struct amdgpu_hive_info *, if (_T) amdgpu_put_xgmi_hive(_T))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user