[PATCH] drm/amd/powerplay: Zero out power data in AMDGPU_PP_SENSOR_GPU_POWER readout

Deucher, Alexander Alexander.Deucher at amd.com
Tue Feb 6 19:18:48 UTC 2018


Reviewed-by: Alex Deucher <alexander.deucher at amd.com>


________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Tom St Denis <tom.stdenis at amd.com>
Sent: Tuesday, February 6, 2018 2:09 PM
To: amd-gfx at lists.freedesktop.org
Cc: StDenis, Tom
Subject: [PATCH] drm/amd/powerplay: Zero out power data in AMDGPU_PP_SENSOR_GPU_POWER readout

Since 12 of the 16 bytes are not initialized with anything let's ensure they're
sensibly zeroed out otherwise debugfs callers will read back garbage
(because they assume debugfs wrote sensible data back...)

Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 5e3c63f8b62a..341fba5f7171 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -3889,7 +3889,9 @@ static int vega10_get_gpu_power(struct pp_hwmgr *hwmgr,
                         return -EINVAL);

         vega10_read_arg_from_smc(hwmgr, &value);
+
         /* power value is an integer */
+       memset(query, 0, sizeof *query);
         query->average_gpu_power = value << 8;

         return 0;
--
2.14.3

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20180206/9040aaaf/attachment-0001.html>


More information about the amd-gfx mailing list