Skip to content

Commit cca9658

Browse files
committed
drm/msm/a6xx: Fix missing ARRAY_SIZE() check
Fixes: f6d62d0 ("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
1 parent 17154ad commit cca9658

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

drivers/gpu/drm/msm/adreno/a6xx_gpu.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -683,19 +683,23 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
683683
{
684684
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
685685
const u32 *regs = a6xx_protect;
686-
unsigned i, count = ARRAY_SIZE(a6xx_protect), count_max = 32;
687-
688-
BUILD_BUG_ON(ARRAY_SIZE(a6xx_protect) > 32);
689-
BUILD_BUG_ON(ARRAY_SIZE(a650_protect) > 48);
686+
unsigned i, count, count_max;
690687

691688
if (adreno_is_a650(adreno_gpu)) {
692689
regs = a650_protect;
693690
count = ARRAY_SIZE(a650_protect);
694691
count_max = 48;
692+
BUILD_BUG_ON(ARRAY_SIZE(a650_protect) > 48);
695693
} else if (adreno_is_a660_family(adreno_gpu)) {
696694
regs = a660_protect;
697695
count = ARRAY_SIZE(a660_protect);
698696
count_max = 48;
697+
BUILD_BUG_ON(ARRAY_SIZE(a660_protect) > 48);
698+
} else {
699+
regs = a6xx_protect;
700+
count = ARRAY_SIZE(a6xx_protect);
701+
count_max = 32;
702+
BUILD_BUG_ON(ARRAY_SIZE(a6xx_protect) > 32);
699703
}
700704

701705
/*

0 commit comments

Comments
 (0)