drm/amd/display: fix NULL pointer in dm_commit_surfaces

Check if adding surface is failed to prevent NULL pointer deref.

Signed-off-by: Jerry Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Jerry Zuo 2017-05-24 11:01:32 -04:00 committed by Alex Deucher
parent ece22899a4
commit afdbd4ccfd

View File

@ -2411,6 +2411,10 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
if (crtc == pcrtc) {
add_surface(dm->dc, crtc, plane,
&dc_surfaces_constructed[planes_count]);
if (dc_surfaces_constructed[planes_count] == NULL) {
dm_error("%s: Failed to add surface!\n", __func__);
continue;
}
dc_stream_attach = acrtc_attach->stream;
planes_count++;
}