Skip to contentSkip to conversation

drm/amdgpu: Free CPER entry after committing to ring

PATCH In review Xiang Liu 2 participants 2 messages Feb 28, 2025

Subsystems (2)
lore
Share & tools
lore

Xiang Liu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Free CPER entry after committing to ring

Free CPER entry when it's committed to CPER ring to avoid memory leak.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c +3 -0
index 15cd0a007b71..0415ed222342 100644
@@ -301,6 +301,7 @@ int amdgpu_cper_generate_ue_record(struct amdgpu_device *adev,
 		return ret;
 
 	amdgpu_cper_ring_write(ring, fatal, fatal->record_length);
+	kfree(fatal);
 
 	return 0;
 }
@@ -323,6 +324,7 @@ int amdgpu_cper_generate_bp_threshold_record(struct amdgpu_device *adev)
 		return ret;
 
 	amdgpu_cper_ring_write(ring, bp_threshold, bp_threshold->record_length);
+	kfree(bp_threshold);
 
 	return 0;
 }
@@ -399,6 +401,7 @@ int amdgpu_cper_generate_ce_records(struct amdgpu_device *adev,
 	}
 
 	amdgpu_cper_ring_write(ring, corrected, corrected->record_length);
+	kfree(corrected);
 
 	return 0;
 }
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Regards,
Hawking
-----Original Message-----
From: Liu, Xiang(Dean) <[email protected]>
Sent: Friday, February 28, 2025 11:12
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
Subject: [PATCH] drm/amdgpu: Free CPER entry after committing to ring

Free CPER entry when it's committed to CPER ring to avoid memory leak.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cper.c +3 -0
index 15cd0a007b71..0415ed222342 100644
@@ -301,6 +301,7 @@ int amdgpu_cper_generate_ue_record(struct amdgpu_device *adev,
                return ret;
 
        amdgpu_cper_ring_write(ring, fatal, fatal->record_length);
+       kfree(fatal);
 
        return 0;
 }
@@ -323,6 +324,7 @@ int amdgpu_cper_generate_bp_threshold_record(struct amdgpu_device *adev)
                return ret;
 
        amdgpu_cper_ring_write(ring, bp_threshold, bp_threshold->record_length);
+       kfree(bp_threshold);
 
        return 0;
 }
@@ -399,6 +401,7 @@ int amdgpu_cper_generate_ce_records(struct amdgpu_device *adev,
        }
 
        amdgpu_cper_ring_write(ring, corrected, corrected->record_length);
+       kfree(corrected);
 
        return 0;
 }

--
2.34.1