Skip to contentSkip to conversation

drm/amd/display: remove redundant null pointer check before kfree

PATCH zhong jiang 2 participants 2 messages Sep 21, 2018 4 messages not in the archive

lore
Share & tools
lore

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

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

A message that is not in the archive (sent off-list or not yet received): 18ebd398-9eeb-54e7-96ff-19a1c34bdcd3-5C7GfCeVMHo@public.gmane.org

#3 lore raw
Quoted 5 lines · Harry Wentland
Quoted 3 lines · zhong jiang

kfree has taken the null pointer into account. hence it is safe to remove the redundant null pointer check before kfree.

Please send patches for drivers/gpu/drm/amd to [email protected] for review.

+cc [email protected]. Do I need to resend it ?

Sincerely,
zhong jiang

Quoted 15 lines

Harry

Quoted 13 lines
---
 drivers/gpu/drm/amd/display/modules/stats/stats.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/modules/stats/stats.c +0 -0
index 3d4c1b1..03121ca 100644
@@ -186,12 +186,8 @@ void mod_stats_destroy(struct mod_stats *mod_stats)
 	if (mod_stats != NULL) {
 		struct core_stats *core_stats = MOD_STATS_TO_CORE(mod_stats);
 
Quoted 13 lines

drivers/gpu/drm/amd/display/modules/stats/stats.c void mod_stats_destroy(struct mod_stats *mod_stats) · line 193

Quoted 12 lines
drivers/gpu/drm/amd/display/modules/stats/stats.c +2 -6
-		if (core_stats->time != NULL)
-			kfree(core_stats->time);
-
-		if (core_stats->events != NULL)
-			kfree(core_stats->events);
-
+		kfree(core_stats->time);
+		kfree(core_stats->events);
 		kfree(core_stats);
 	}
 }

_______________________________________________
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]

Reviewed-by
#5 lore raw
Quoted 8 lines · zhong jiang
Quoted 5 lines · Harry Wentland
Quoted 3 lines · zhong jiang

kfree has taken the null pointer into account. hence it is safe to remove the redundant null pointer check before kfree.

Please send patches for drivers/gpu/drm/amd to [email protected] for review.

+cc [email protected]. Do I need to resend it ?

Thanks. No need this time. Next time send to amd-gfx directly.

I'll pull it in.

Harry

Quoted 32 lines

Sincerely,
zhong jiang

Quoted 28 lines

Harry

Quoted 25 lines
---
 drivers/gpu/drm/amd/display/modules/stats/stats.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/modules/stats/stats.c +2 -6
index 3d4c1b1..03121ca 100644
@@ -186,12 +186,8 @@ void mod_stats_destroy(struct mod_stats *mod_stats)
 	if (mod_stats != NULL) {
 		struct core_stats *core_stats = MOD_STATS_TO_CORE(mod_stats);
 
-		if (core_stats->time != NULL)
-			kfree(core_stats->time);
-
-		if (core_stats->events != NULL)
-			kfree(core_stats->events);
-
+		kfree(core_stats->time);
+		kfree(core_stats->events);
 		kfree(core_stats);
 	}
 }

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