drm/amd/display: remove redundant null pointer check before kfree
authorzhong jiang <zhongjiang@huawei.com>
Fri, 21 Sep 2018 13:12:11 +0000 (21:12 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Sep 2018 02:09:12 +0000 (21:09 -0500)
kfree has taken the null pointer into account. hence it is safe
to remove the redundant null pointer check before kfree.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/modules/stats/stats.c

index 3d4c1b1ab8c4d4ce08f55b127e6d4b8e028ccdc3..03121ca64fe4bbfb0f7ea8b4996d04e9944683ef 100644 (file)
@@ -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);
        }
 }