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

Submitted by Alex Deucher on Nov. 22, 2016, 4:57 p.m.

Details

Message ID 1479833848-14275-9-git-send-email-alexander.deucher@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Alex Deucher Nov. 22, 2016, 4:57 p.m.
Fail gracefully if mem_input is NULL.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@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 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);