mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dc.c:use kzalloc without test
@ 2019-10-23  8:32 zhongshiqi
  2019-10-23 13:35 ` Harry Wentland
  0 siblings, 1 reply; 3+ messages in thread
From: zhongshiqi @ 2019-10-23  8:32 UTC (permalink / raw)
  To: harry.wentland
  Cc: sunpeng.li, alexander.deucher, christian.koenig, David1.Zhou,
	airlied, daniel, Bhawanpreet.Lakha, Jun.Lei, David.Francis,
	Dmytro.Laktyushkin, anthony.koo, Wenjing.Liu,
	nicholas.kazlauskas, Aidan.Wood, Chris.Park, Eric.Yang2, amd-gfx,
	dri-devel, linux-kernel, xue.zhihong, wang.yi59, cheng.shengyu,
	zhongshiqi

dc.c:583:null check is needed after using kzalloc function

Signed-off-by: zhongshiqi <zhong.shiqi@zte.com.cn>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 5d1aded..4b8819c 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -580,6 +580,10 @@ static bool construct(struct dc *dc,
 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
 	// Allocate memory for the vm_helper
 	dc->vm_helper = kzalloc(sizeof(struct vm_helper), GFP_KERNEL);
+	if (!dc->vm_helper) {
+		dm_error("%s: failed to create dc->vm_helper\n", __func__);
+		goto fail;
+	}
 
 #endif
 	memcpy(&dc->bb_overrides, &init_params->bb_overrides, sizeof(dc->bb_overrides));
-- 
2.9.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-25 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23  8:32 [PATCH] dc.c:use kzalloc without test zhongshiqi
2019-10-23 13:35 ` Harry Wentland
2019-10-25 19:32   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®