Skip to contentSkip to conversation

drm/amd/powerplay: Remove unneeded cast from memory allocation

PATCH Applied Li Heng 2 participants 2 messages Jul 29, 2020

Subsystems (2)
lore
Share & tools
lore

Li Heng

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: Remove unneeded cast from memory allocation

Remove casting the values returned by memory allocation function.

Coccinelle emits WARNING:

./drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c:893:37-46: WARNING: casting value returned by memory allocation function to (PPTable_t *) is useless.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c +1 -1
index 7a7f15d..f56a3cb 100644
@@ -890,7 +890,7 @@ static int init_powerplay_table_information(
 				power_saving_clock_count);
 	}
 
-	pptable_information->smc_pptable = (PPTable_t *)kmalloc(sizeof(PPTable_t), GFP_KERNEL);
+	pptable_information->smc_pptable = kmalloc(sizeof(PPTable_t), GFP_KERNEL);
 	if (pptable_information->smc_pptable == NULL)
 		return -ENOMEM;
 
Signature · 1 line
2.7.4
Applied
#1 lore raw

Applied. Thanks!

Alex

Quoted 28 lines · Li Heng

Remove casting the values returned by memory allocation function.

Coccinelle emits WARNING:

./drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c:893:37-46: WARNING: casting value returned by memory allocation function to (PPTable_t *) is useless.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_processpptables.c +1 -2
index 7a7f15d..f56a3cb 100644
@@ -890,7 +890,7 @@ static int init_powerplay_table_information(
                                power_saving_clock_count);
        }
 
-       pptable_information->smc_pptable = (PPTable_t *)kmalloc(sizeof(PPTable_t), GFP_KERNEL);
+       pptable_information->smc_pptable = kmalloc(sizeof(PPTable_t), GFP_KERNEL);
        if (pptable_information->smc_pptable == NULL)
                return -ENOMEM;
 
--

2.7.4

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