]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/msm/a6xx: Fix missing ARRAY_SIZE() check
authorRob Clark <robdclark@chromium.org>
Sat, 5 Mar 2022 17:34:03 +0000 (09:34 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:57:51 +0000 (11:57 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit cca96584b35765bf9eb5f38ca55a144ea2ba0de4 ]

Fixes: f6d62d091cfd ("drm/msm/a6xx: add support for Adreno 660 GPU")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220305173405.914989-1-robdclark@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f23b4c9c6a5adad9df53669699a7c75b1272e5d4)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/gpu/drm/msm/adreno/a6xx_gpu.c

index b681c45520bbd3ea7123d287d9f1fed2d666d3c0..f54bfdb1ebffaa37fcf0ddb7943843d7d5b965b3 100644 (file)
@@ -658,19 +658,23 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
 {
        struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
        const u32 *regs = a6xx_protect;
-       unsigned i, count = ARRAY_SIZE(a6xx_protect), count_max = 32;
-
-       BUILD_BUG_ON(ARRAY_SIZE(a6xx_protect) > 32);
-       BUILD_BUG_ON(ARRAY_SIZE(a650_protect) > 48);
+       unsigned i, count, count_max;
 
        if (adreno_is_a650(adreno_gpu)) {
                regs = a650_protect;
                count = ARRAY_SIZE(a650_protect);
                count_max = 48;
+               BUILD_BUG_ON(ARRAY_SIZE(a650_protect) > 48);
        } else if (adreno_is_a660_family(adreno_gpu)) {
                regs = a660_protect;
                count = ARRAY_SIZE(a660_protect);
                count_max = 48;
+               BUILD_BUG_ON(ARRAY_SIZE(a660_protect) > 48);
+       } else {
+               regs = a6xx_protect;
+               count = ARRAY_SIZE(a6xx_protect);
+               count_max = 32;
+               BUILD_BUG_ON(ARRAY_SIZE(a6xx_protect) > 32);
        }
 
        /*