[PATCH][next] drm/amd/powerplay: fix out of memory check on od8_settings

Abramov, Slava Slava.Abramov at amd.com
Fri Jun 28 15:49:07 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 11:13:54 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][next] drm/amd/powerplay: fix out of memory check on od8_settings

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

The null pointer check on od8_settings is currently the opposite of what
it is intended to do. Fix this by adding in the missing ! operator.

Addressed-Coverity: ("Resource leak")
Fixes: 0c83d32c565c ("drm/amd/powerplay: simplified od_settings for each asic")
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
index 0f14fe14ecd8..eb9e6b3a5265 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
@@ -1501,8 +1501,7 @@ static int vega20_set_default_od8_setttings(struct smu_context *smu)
                 return -EINVAL;

         od8_settings = kzalloc(sizeof(struct vega20_od8_settings), GFP_KERNEL);
-
-       if (od8_settings)
+       if (!od8_settings)
                 return -ENOMEM;

         smu->od_settings = (void *)od8_settings;
--
2.20.1

_______________________________________________
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/20190628/877301d0/attachment.html>


More information about the amd-gfx mailing list