[PATCH] drm/amd/powerplay: Fix uninitialized warning in arcturus ppt driver (v2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fixes:

  CC [M]  drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_mst_types.o
drivers/gpu/drm/amd/amdgpu/../powerplay/arcturus_ppt.c: In function ‘arcturus_log_thermal_throttling_event’:
drivers/gpu/drm/amd/amdgpu/../powerplay/arcturus_ppt.c:2223:24: warning: ‘throttler_status’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 2223 |   if (throttler_status & logging_label[throttler_idx].feature_mask) {

By assigning an initial value and also checking for errors on the call to
arcturus_get_smu_metrics_data().

(v2): don't set default in arcturus_get_smu_metrics_data()

Signed-off-by: Tom St Denis <tom.stdenis@xxxxxxx>
---
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index 8b1025dc54fd..f6fe8e0ff977 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -2208,15 +2208,20 @@ static const struct throttling_logging_label {
 };
 static void arcturus_log_thermal_throttling_event(struct smu_context *smu)
 {
-	int throttler_idx, throtting_events = 0, buf_idx = 0;
+	int throttler_idx, throtting_events = 0, buf_idx = 0, ret;
 	struct amdgpu_device *adev = smu->adev;
-	uint32_t throttler_status;
+	uint32_t throttler_status = 0;
 	char log_buf[256];
 
-	arcturus_get_smu_metrics_data(smu,
+	ret = arcturus_get_smu_metrics_data(smu,
 				      METRICS_THROTTLER_STATUS,
 				      &throttler_status);
 
+	if (ret) {
+		dev_err(adev->dev, "Could not read from arcturus_get_smu_metrics_data()\n");
+		return;
+	}
+
 	memset(log_buf, 0, sizeof(log_buf));
 	for (throttler_idx = 0; throttler_idx < ARRAY_SIZE(logging_label);
 	     throttler_idx++) {
-- 
2.26.2

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux