Skip to contentSkip to conversation

drm/amd/powerplay: fix memory allocation failure check V2

PATCH In review Evan Quan 2 participants 3 messages Jul 12, 2019 – Jul 16, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: fix memory allocation failure check V2

Fix memory allocation failure check.

- V2: fix one more similar error

Change-Id I012b082a7a2b92973a76db8029897fb4a3441694
---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +2 -2
index 1fc367307ac0..c826e65430b6 100644
@@ -319,7 +319,7 @@ static int vega20_tables_init(struct smu_context *smu, struct smu_table *tables)
 	               AMDGPU_GEM_DOMAIN_VRAM);
 
 	smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t), GFP_KERNEL);
-	if (smu_table->metrics_table)
+	if (!smu_table->metrics_table)
 		return -ENOMEM;
 	smu_table->metrics_time = 0;
 
@@ -1502,7 +1502,7 @@ static int vega20_set_default_od8_setttings(struct smu_context *smu)
 
 	od8_settings = kzalloc(sizeof(struct vega20_od8_settings), GFP_KERNEL);
 
-	if (od8_settings)
+	if (!od8_settings)
 		return -ENOMEM;
 
 	smu->od_settings = (void *)od8_settings;
Signature · 6 lines
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw

Ping..

Quoted 44 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: Friday, July 12, 2019 1:23 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: fix memory allocation failure check V2

Fix memory allocation failure check.

- V2: fix one more similar error

Change-Id I012b082a7a2b92973a76db8029897fb4a3441694
---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -1
index 1fc367307ac0..c826e65430b6 100644
@@ -319,7 +319,7 @@ static int vega20_tables_init(struct smu_context
 *smu, struct smu_table *tables)
 	               AMDGPU_GEM_DOMAIN_VRAM);
 
 	smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t),
 GFP_KERNEL);
-	if (smu_table->metrics_table)
+	if (!smu_table->metrics_table)
 		return -ENOMEM;
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -1
 	smu_table->metrics_time = 0;
@@ -1502,7 +1502,7 @@ static int vega20_set_default_od8_setttings(struct
 smu_context *smu)
 
 	od8_settings = kzalloc(sizeof(struct vega20_od8_settings),
 GFP_KERNEL);
 
-	if (od8_settings)
+	if (!od8_settings)
 		return -ENOMEM;
Quoted 3 lines

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

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#3 lore raw
In reply to a message not in the archive
Quoted 7 lines · Evan Quan

Fix memory allocation failure check.

- V2: fix one more similar error

Change-Id I012b082a7a2b92973a76db8029897fb4a3441694
Quoted 29 lines
---
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +2 -3
index 1fc367307ac0..c826e65430b6 100644
@@ -319,7 +319,7 @@ static int vega20_tables_init(struct smu_context *smu, struct smu_table *tables)
                       AMDGPU_GEM_DOMAIN_VRAM);
 
        smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t), GFP_KERNEL);
-       if (smu_table->metrics_table)
+       if (!smu_table->metrics_table)
                return -ENOMEM;
        smu_table->metrics_time = 0;
 
@@ -1502,7 +1502,7 @@ static int vega20_set_default_od8_setttings(struct smu_context *smu)
 
        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.21.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx