Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp794774pxp; Sat, 5 Mar 2022 19:50:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUa4Sp/U3U7JyA7NPPvT/dVeDrVt67tG609t1bONU6Zd2OIhElqkE9Y6iDom3WXCzYiOnL X-Received: by 2002:aa7:c54b:0:b0:415:c714:7a1f with SMTP id s11-20020aa7c54b000000b00415c7147a1fmr5099566edr.385.1646538632231; Sat, 05 Mar 2022 19:50:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646538632; cv=none; d=google.com; s=arc-20160816; b=cBmjxvLSHdhqyQzP4Sw81dV92lp6o6I0JM5TUAIemCOQh6ErQ6q57ETu3l5Lv9FPoJ PoHWVAaK1hhthGcCTM13mSk68EFV9jbjMdqCi67BKihWB0ibmJJ1dbeJxvCNQRyxnbXz SIOuZ05i7uenOzxGQq5g/Rz5pKmsoeWlKu79WZeh9Vk4GzDaJcfMorIuHN5u8WOKik1N YqlUGUKdErtlVaWrVS4h8yl86cjCyzZWg9Mo6yFY/mFt4+/xV7TY7z4M5Q8tP3O5J/UD g2ePDJkBbM1JRqzeQwHwGK/BWu41/Pvt1AL45k6vwvuJ+O9kYaHUHqb/Q8bfJhIZ3tku icCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=12jc84zVACmPZitAQSCb3aE5VlqyZHrB+UXDuxQbIOc=; b=pbTUOEpNnJ2tCf1GCmjISLnx7e0PlJuEgHBcyamaNp2gu0d9Uqq556cGGx9LmfgbhH Urn7U4DHaRBTG5m5foON7q3nN9NzGeYrxN2i5WIX9/fAZ/VgcitUdpfFScy1zekaRWH6 WP1vD3V8OKKInL/OPsVFF8sJGvOYATqL22Qtk1tsgD/GeJzQd3RjSgewsHvtcB/XSh/4 1h4ygtiHUcQ73WfjOiwp4FkqOvrfGOWG0pCt1L1Ps84x+wA+Fw0VdFjvjHJpcnAVGxkU TrfgTSj+yNVXO07mmCgmXxtc/IvWtnb08EMxUoMhkJrOxKepUTyxW4l/eevUGglfJpxr 3cZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OJKGYJts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ox26-20020a170907101a00b006daac6be783si4017276ejb.106.2022.03.05.19.49.58; Sat, 05 Mar 2022 19:50:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OJKGYJts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232140AbiCERe1 (ORCPT + 99 others); Sat, 5 Mar 2022 12:34:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230426AbiCEReZ (ORCPT ); Sat, 5 Mar 2022 12:34:25 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D683C15137C; Sat, 5 Mar 2022 09:33:35 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id 132so10112620pga.5; Sat, 05 Mar 2022 09:33:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=12jc84zVACmPZitAQSCb3aE5VlqyZHrB+UXDuxQbIOc=; b=OJKGYJts4lLE8sv13wBz+01+qJke1kaef4oTLqY+k4PRzNLU9gIOW/2YYRAMR5Is19 YWW/6bQLg21aOiZ2U9RzSZS0io6k2XgufBQU7fsgymUBtvEkOVJbio6mUTZOPHjZv5mk yWnvftE8JsLQG1Vcu1UNu5e1PhWmQvmtCHzbc8nXGTmzj910ZIVMK1lkz5Jf0CQrlA0G RQ6ie8vDIYEDONm2VGnBSrDHpKWhaq+tMz87ZVoQnQK0I9vEJnM6nT2jEyfUBedFw6z9 O1wea9/NgpRcO+0/QKorOYL5InhT1hFEWGF2Nnunn2xYpqH6xClZ9LyRpM17ALe1KNTk 5LlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=12jc84zVACmPZitAQSCb3aE5VlqyZHrB+UXDuxQbIOc=; b=eoBi69u1O1aUG1Muo1YtiYKL4NHVpIQyDU3ORbUsIbf/pIPzMlUystYOBUP1IYPHcH bf6QD8G1dJBudj8G38rS5hgfPsxaLjDtrFQyBQPCLZN6wfaabMcKt1Z5If7/5wqL4xMb GByiHTr/sFFYl6XfLbvyYHFoA7/32P/qjxRHnCBG6wyVTetvzH7w7WtkW+6uIU1xpCnM aRt9bgcmNJ7z8tkFxOF254OyZAgDpM/7ZgXITSaqISR816ZZWWsKf+J9LrJ2l/aMQtHq R+5HwJMrX4yPPwpFX71CzpGL2oBtDuLdmofb6RWx1bMkjkPWTiudkg78PRXwUdvl1llX oOVw== X-Gm-Message-State: AOAM531mxGKK4spvRHnh2IMCTtIF7ABOiFK5WxotIkMBlcsTsulEbtJM 2psMVP4Pm1Oh7y3bHxEu3Sg= X-Received: by 2002:a05:6a00:180d:b0:4f6:d697:7df9 with SMTP id y13-20020a056a00180d00b004f6d6977df9mr3302231pfa.71.1646501610505; Sat, 05 Mar 2022 09:33:30 -0800 (PST) Received: from localhost ([2601:1c0:5200:a6:307:a401:7b76:c6e5]) by smtp.gmail.com with ESMTPSA id l62-20020a633e41000000b0037fee1843dbsm2922838pga.25.2022.03.05.09.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Mar 2022 09:33:28 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Rob Clark , Dmitry Baryshkov , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , Akhil P Oommen , Jonathan Marek , Jordan Crouse , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] drm/msm/a6xx: Fix missing ARRAY_SIZE() check Date: Sat, 5 Mar 2022 09:34:03 -0800 Message-Id: <20220305173405.914989-1-robdclark@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark Fixes: f6d62d091cfd ("drm/msm/a6xx: add support for Adreno 660 GPU") Signed-off-by: Rob Clark Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 02b47977b5c3..83c31b2ad865 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -683,19 +683,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); } /* -- 2.35.1