[PATCH 35/39] drm/amd/dal: handle NULL mem_input in dc_init_dchub

Harry Wentland harry.wentland at amd.com
Thu Nov 24 02:03:04 UTC 2016


From: Alex Deucher <alexander.deucher at amd.com>

Fail gracefully if mem_input is NULL.

Change-Id: Ie49de3cbc2a56d6cd1f28048ce034f984b63c037
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
 drivers/gpu/drm/amd/dal/dc/core/dc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc.c b/drivers/gpu/drm/amd/dal/dc/core/dc.c
index c42d0d49ca92..1e337e427d06 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc.c
@@ -1810,7 +1810,7 @@ bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data)
 {
 	int i;
 	struct core_dc *core_dc = DC_TO_CORE(dc);
-	struct mem_input *mi;
+	struct mem_input *mi = NULL;
 
 	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
 		if (core_dc->res_pool->mis[i] != NULL) {
@@ -1818,6 +1818,10 @@ bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data)
 			break;
 		}
 	}
+	if (mi == NULL) {
+		dm_error("no mem_input!\n");
+		return false;
+	}
 
 	if (mi->funcs->mem_input_update_dchub)
 		mi->funcs->mem_input_update_dchub(mi, dh_data);
-- 
2.10.1



More information about the amd-gfx mailing list