From: Bhawanpreet Lakha Date: Tue, 9 Oct 2018 17:47:34 +0000 (-0400) Subject: drm/amd/display: Fix potential nullptr error X-Git-Tag: v4.20.8~333 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d972ff1f7031e2f361edf119292074124e4f65d1;p=users%2Fdwmw2%2Flinux.git drm/amd/display: Fix potential nullptr error [ Upstream commit 4f7129112c2a30331f3045a42026fad82e6cb72b ] [Why] Fix surface/plane potential nullptr [How] add null check Signed-off-by: Bhawanpreet Lakha Reviewed-by: Aric Cyr Acked-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 3118ae0e7a87c..315a245aedc29 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -5333,6 +5333,12 @@ enum surface_update_type dm_determine_update_type_for_commit(struct dc *dc, stru struct dc_stream_update stream_update; enum surface_update_type update_type = UPDATE_TYPE_FAST; + if (!updates || !surface) { + DRM_ERROR("Plane or surface update failed to allocate"); + /* Set type to FULL to avoid crashing in DC*/ + update_type = UPDATE_TYPE_FULL; + goto ret; + } for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { new_dm_crtc_state = to_dm_crtc_state(new_crtc_state);