Skip to content

Commit f5261be

Browse files
Kevin Wangalexdeucher
authored andcommitted
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: Kevin Wang <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 9c9b17a commit f5261be

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/gpu/drm/amd/powerplay/arcturus_ppt.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,14 +2204,17 @@ static const struct throttling_logging_label {
22042204
};
22052205
static void arcturus_log_thermal_throttling_event(struct smu_context *smu)
22062206
{
2207+
int ret;
22072208
int throttler_idx, throtting_events = 0, buf_idx = 0;
22082209
struct amdgpu_device *adev = smu->adev;
22092210
uint32_t throttler_status;
22102211
char log_buf[256];
22112212

2212-
arcturus_get_smu_metrics_data(smu,
2213-
METRICS_THROTTLER_STATUS,
2214-
&throttler_status);
2213+
ret = arcturus_get_smu_metrics_data(smu,
2214+
METRICS_THROTTLER_STATUS,
2215+
&throttler_status);
2216+
if (ret)
2217+
return;
22152218

22162219
memset(log_buf, 0, sizeof(log_buf));
22172220
for (throttler_idx = 0; throttler_idx < ARRAY_SIZE(logging_label);

0 commit comments

Comments
 (0)