Commit f5261bec authored by Kevin Wang's avatar Kevin Wang Committed by Alex Deucher

drm/amdgpu: fix uninit-value in arcturus_log_thermal_throttling_event()

when function arcturus_get_smu_metrics_data() call failed,
it will cause the variable "throttler_status" isn't initialized before use.

warning:
powerplay/arcturus_ppt.c:2268:24: warning: ‘throttler_status’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 2268 |   if (throttler_status & logging_label[throttler_idx].feature_mask) {
Signed-off-by: default avatarKevin Wang <kevin1.wang@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 9c9b17a7
...@@ -2204,14 +2204,17 @@ static const struct throttling_logging_label { ...@@ -2204,14 +2204,17 @@ static const struct throttling_logging_label {
}; };
static void arcturus_log_thermal_throttling_event(struct smu_context *smu) static void arcturus_log_thermal_throttling_event(struct smu_context *smu)
{ {
int ret;
int throttler_idx, throtting_events = 0, buf_idx = 0; int throttler_idx, throtting_events = 0, buf_idx = 0;
struct amdgpu_device *adev = smu->adev; struct amdgpu_device *adev = smu->adev;
uint32_t throttler_status; uint32_t throttler_status;
char log_buf[256]; char log_buf[256];
arcturus_get_smu_metrics_data(smu, ret = arcturus_get_smu_metrics_data(smu,
METRICS_THROTTLER_STATUS, METRICS_THROTTLER_STATUS,
&throttler_status); &throttler_status);
if (ret)
return;
memset(log_buf, 0, sizeof(log_buf)); memset(log_buf, 0, sizeof(log_buf));
for (throttler_idx = 0; throttler_idx < ARRAY_SIZE(logging_label); for (throttler_idx = 0; throttler_idx < ARRAY_SIZE(logging_label);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment