[PATCH 09/11] drm/amd/dal/dc: handle NULL mem_input in dc_init_dchub

Alex Deucher alexdeucher at gmail.com
Tue Nov 22 16:57:26 UTC 2016


Fail gracefully if mem_input is NULL.

Reviewed-by: Harry Wentland <harry.wentland at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher 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 7636fc6..106f60f 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc.c
@@ -1808,7 +1808,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) {
@@ -1816,6 +1816,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.5.5



More information about the amd-gfx mailing list