From: Wesley Chalmers <[email protected]>

[WHY]
Currently, when insert_plane is called with insert_above_mpcc
parameter that is equal to tree->opp_list, the function returns NULL.

[HOW]
Instead, the function should insert the plane at the top of the tree.

Cc: Mario Limonciello <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: [email protected]
Reviewed-by: Jun Lei <[email protected]>
Acked-by: Tom Chung <[email protected]>
Signed-off-by: Wesley Chalmers <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c
index 8e9384094f6d..f2f55565e98a 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c
@@ -212,8 +212,9 @@ struct mpcc *mpc1_insert_plane(
                /* check insert_above_mpcc exist in tree->opp_list */
                struct mpcc *temp_mpcc = tree->opp_list;
 
-               while (temp_mpcc && temp_mpcc->mpcc_bot != insert_above_mpcc)
-                       temp_mpcc = temp_mpcc->mpcc_bot;
+               if (temp_mpcc != insert_above_mpcc)
+                       while (temp_mpcc && temp_mpcc->mpcc_bot != 
insert_above_mpcc)
+                               temp_mpcc = temp_mpcc->mpcc_bot;
                if (temp_mpcc == NULL)
                        return NULL;
        }
-- 
2.25.1

Reply via email to