drm/amd/display: Fix a bug when searching for insert_above_mpcc
authorjsg <jsg@openbsd.org>
Tue, 19 Sep 2023 12:54:40 +0000 (12:54 +0000)
committerjsg <jsg@openbsd.org>
Tue, 19 Sep 2023 12:54:40 +0000 (12:54 +0000)
From Wesley Chalmers
77b49370a261c9c79587d4a83960d5db39ee6cfa in linux-6.1.y/6.1.54
3d028d5d60d516c536de1ddd3ebf3d55f3f8983b in mainline linux

sys/dev/pci/drm/amd/display/dc/dcn10/dcn10_mpc.c

index 8e93840..f2f5556 100644 (file)
@@ -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;
        }