[PATCH] drm/amd/powerplay: fix incorrect assignments to mclk_mask and soc_mask

Abramov, Slava Slava.Abramov at amd.com
Fri Jun 28 15:15:56 UTC 2019


Acked-by: Slava Abramov <slava.abramov at amd.com>

________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Colin King <colin.king at canonical.com>
Sent: Friday, June 28, 2019 10:45:17 AM
To: Wang, Kevin(Yang); Rex Zhu; Quan, Evan; Deucher, Alexander; Koenig, Christian; Zhou, David(ChunMing); David Airlie; Daniel Vetter; amd-gfx at lists.freedesktop.org; dri-devel at lists.freedesktop.org
Cc: kernel-janitors at vger.kernel.org; linux-kernel at vger.kernel.org
Subject: [PATCH] drm/amd/powerplay: fix incorrect assignments to mclk_mask and soc_mask

From: Colin Ian King <colin.king at canonical.com>

There are null pointer checks on mlck_mask and soc_mask however the
sclk_mask is being used in assignments in what looks to be a cut-n-paste
coding error. Fix this by using the correct pointers in the assignments.

Addresses-Coverity: ("Dereference after null check")
Fixes: 2d9fb9b06643 ("drm/amd/powerplay: add function get_profiling_clk_mask for navi10")
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index 27e5c80..ac151da 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -1134,14 +1134,14 @@ static int navi10_get_profiling_clk_mask(struct smu_context *smu,
                         ret = smu_get_dpm_level_count(smu, SMU_MCLK, &level_count);
                         if (ret)
                                 return ret;
-                       *sclk_mask = level_count - 1;
+                       *mclk_mask = level_count - 1;
                 }

                 if(soc_mask) {
                         ret = smu_get_dpm_level_count(smu, SMU_SOCCLK, &level_count);
                         if (ret)
                                 return ret;
-                       *sclk_mask = level_count - 1;
+                       *soc_mask = level_count - 1;
                 }
         }

--
2.7.4

_______________________________________________
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/dri-devel/attachments/20190628/5ff4a795/attachment.html>


More information about the dri-devel mailing list