Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4339593ybb; Tue, 14 Apr 2020 05:27:59 -0700 (PDT) X-Google-Smtp-Source: APiQypLFsGMwE2kw7+t8ALNUxJXnp7+w15zHXEYVOO6VXjCxnJ+RRWzT+LggtkT9VVxgAKTnxZxs X-Received: by 2002:a17:907:20a2:: with SMTP id pw2mr13923211ejb.252.1586867279224; Tue, 14 Apr 2020 05:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586867279; cv=none; d=google.com; s=arc-20160816; b=z4m9TC0kN1BwQFaoSP0eEz9PF20hqvBhkdxsCPk7PUFG9/y4//9Q0IcCtcHHfEAijW RVnUtms7a+W9eaSyeFdDKCpPWHeI6aCcsEHYGe63FncpeovzZNtOtRoa2eQDhF50h0RZ DIPew7ziojHJPXwKGsQGe9Q1CE7Zc0TFnCIOFGFrnsvFEgwD98licRbbleupnIbxQ45l 6/FrsBs/vcR576qTdDIpnnaE3u587AtXbgkvrCH8syyopkXG/tdnKbOOJmXY6va0cW4q /59aE/hmfjgpkXQJUOsDYgoy/Tifj8L0fQ0kcEbMdv1vGv73AvvtLXlsNQqQAdPgOxU6 A8mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=nN6vI/Y6V2+OzKGUdIcwXvghnTxr4ncREocLNwdL8+k=; b=ZPvR8FeK1+QFdpnlJyVJsDFwtrGNOyA4aix20zkzNj6McPTSDmMBhgoKHCbEA3tHwV zNeLdSGsalcJdnADEHrzBBndaq97fWx8/n7iqkeTIAH0JDxRjK08+BX030SAVGsrMoqB 1Ri6MHZGmith8fCqD1upJQ8d72wykxPJy2ByRnj6E50vVA/9sqirs3YcImmFhUAKtAkp Q8morOaBNC2yXvMMnRiFqFv6zVyVQ9mJy5yRv4yKuFFQMhCQR+GNwX0W0+o9hRQef+6N 4KgLnmd0Gae1XKEr3nrMHMEJM0bB4KOApQc3+UujDxcX+echxqfhK/zKZUs8SEk4VcTX aL3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k25si3588653edx.4.2020.04.14.05.27.35; Tue, 14 Apr 2020 05:27:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730305AbgDMOGH (ORCPT + 99 others); Mon, 13 Apr 2020 10:06:07 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2310 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730301AbgDMOGG (ORCPT ); Mon, 13 Apr 2020 10:06:06 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B91073424AE328FD0861; Mon, 13 Apr 2020 22:06:02 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Mon, 13 Apr 2020 22:05:56 +0800 From: Jason Yan To: , , , , , , , , , , CC: Jason Yan Subject: [PATCH] drm/i915/gvt: Use ARRAY_SIZE instead of hardcoded size Date: Mon, 13 Apr 2020 22:32:24 +0800 Message-ID: <20200413143224.22806-1-yanaijie@huawei.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the following coccicheck warning: drivers/gpu/drm/i915/gvt/vgpu.c:127:30-31: WARNING: Use ARRAY_SIZE Signed-off-by: Jason Yan --- drivers/gpu/drm/i915/gvt/vgpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c index 1d5ff88078bd..7d361623ff67 100644 --- a/drivers/gpu/drm/i915/gvt/vgpu.c +++ b/drivers/gpu/drm/i915/gvt/vgpu.c @@ -124,7 +124,7 @@ int intel_gvt_init_vgpu_types(struct intel_gvt *gvt) */ low_avail = gvt_aperture_sz(gvt) - HOST_LOW_GM_SIZE; high_avail = gvt_hidden_sz(gvt) - HOST_HIGH_GM_SIZE; - num_types = sizeof(vgpu_types) / sizeof(vgpu_types[0]); + num_types = ARRAY_SIZE(vgpu_types); gvt->types = kcalloc(num_types, sizeof(struct intel_vgpu_type), GFP_KERNEL); -- 2.21.1