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

Submitted by Harry Wentland on Nov. 24, 2016, 2:03 a.m.

Details

Message ID 20161124020308.28124-36-harry.wentland@amd.com
State New
Headers show
Series "dal patches for nov 23, 2016" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Harry Wentland Nov. 24, 2016, 2:03 a.m.
From: Alex Deucher <alexander.deucher@amd.com>

Fail gracefully if mem_input is NULL.

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

Patch hide | download patch | download mbox

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);