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

Submitted by Colin King on June 28, 2019, 3:13 p.m.


Message ID 20190628151354.14107-1-colin.king@canonical.com
State New
Headers show
Series "drm/amd/powerplay: fix out of memory check on od8_settings" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Colin King June 28, 2019, 3:13 p.m.
From: Colin Ian King <colin.king@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@canonical.com>
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

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;