Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1149687ybh; Sat, 14 Mar 2020 19:25:21 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuR+mdwPEQ5AFdJI9/lY5bEe/kPyoABxUqAaYniNbnXITAu1VbdBC7k2CjK3tKfwuQWXU+L X-Received: by 2002:aca:3a42:: with SMTP id h63mr2787400oia.81.1584239121827; Sat, 14 Mar 2020 19:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584239121; cv=none; d=google.com; s=arc-20160816; b=FVBp3Wyjnljg5v1ZWyNHT3jezhbNjL9uRtIn9u4D3zFqF2hdhIbJKKVhHMHrDcWVGT KhuI7Auao9yRxHdscpjzrIVSwT0vusurN70AdNkiZ1jNA0kX1SPdIo5Jrq/2c98BjQYP 6mesJ5feYxWetJ7tHumc7nLnMZKMeKSrJV5Q+XyRzaY0eEODq/Xkz1MGHV0gVptu+OSm aFPWIt0F7D7sKvy01zP9l+D6XUsj+vY8p3ZDlNcZkyiaDwwvU25vnOwXPXvp+QlCdw8S HYLve/bsoSR7nyZMOfbbVNlTFB4eiVUF9aYZmXEsYBuQnwLkn54uZRv6RkviJJljc/Kz OmFw== 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:dkim-signature; bh=YTRlStYJT6c+xh2/kbNHCZEHeFnPg49NCOCN35OUe+c=; b=B9tMwWcl+SB4PQ+l7qwA+wNRtGSRiQgebfoqJWWDLMIJ4/U17xvX2VYeAO9KXenpiJ PWprvpcuxUbdQuYwuLtyEbef116cJAzRNsTy1+BbB6xaMUgdM12DfVvy5ahwHtE2+bmD SrYYuI0muHxKHedkaH+lQOzba2vnzPKr8zz15jHUACtrDWLSHqLwTcvm9AHRVlx6JzwP Bz1KnJ7mqyJ5zzBCXW6Q79N8QS9eMKcbtRcSiP12I6schyPpAqm3FyTbYvuUCd9PvIAo OB7VZF/ctz4xWBd9IfKGEpJ4ji9tS9Oedd20lDR/jaE6PojghXnqSLUKzHm1sXB9hmwi ynLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=ZeR190iG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w33si7067951otb.48.2020.03.14.19.25.09; Sat, 14 Mar 2020 19:25:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=ZeR190iG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727877AbgCOCXj (ORCPT + 99 others); Sat, 14 Mar 2020 22:23:39 -0400 Received: from mout.gmx.net ([212.227.17.22]:51867 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbgCOCXi (ORCPT ); Sat, 14 Mar 2020 22:23:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1584239017; bh=V0rq/NHA00NI5YnNp0x0uYL1fI/UE5EKZlIF0XhdxTc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=ZeR190iGYErOkG14DcPyoWDG+9wpU8BlYLQ9OLybGJThewuUgYJ6UMzX6T477ux4o jdQJ+1Bfa6Z23DfK+2wruSxlbisp0VGoM3cFjyeCCEFgbvRIjHAj944c/KDsiEQssz HI06DIO7boJTCRUOT5OaYVNjN0ehRbSD6EqBOUJM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([83.52.229.196]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MmULx-1jdSIk43NZ-00iWkv; Sat, 14 Mar 2020 17:48:20 +0100 From: Oscar Carter To: Greg Kroah-Hartman , Forest Bond Cc: Quentin Deslandes , Malcolm Priestley , Colin Ian King , Gabriela Bittencourt , Oscar Carter , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: vt6656: Use ARRAY_SIZE instead of hardcoded size Date: Sat, 14 Mar 2020 17:47:54 +0100 Message-Id: <20200314164754.8531-1-oscar.carter@gmx.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:VqoulxDnv12K6z91LHZ6YrGqLdCMqF0Pa57KICKH3pdWYb9OcmH n+5VUMqHAwm75wJO38WkU/60n0tF2eZLwYkBW1d6yEGF7T05XxDjhljoF+sP9aKvmX+fRaT Xh6y+PORdU4K3oA+v75KzDJLQLu8/+Y7io9eHAs0ytG9mIcivfooyZZpnptHw5zilPSPHAj 3LGPGTQBflZSM8MAK/x9Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:5MeGT5rzhdw=:UeLno0Lm86hQkseI50F2fv Q7mJ+xDjrwGQXfTnAlwMqmozrcYDxV7HU3l2O44g3swEraqtsCUOdU6DvSMWUFG5SnE9AJthm Wfbad9RVEoDDPSSddrTLntMG831rrnMpBSc3km4aFLqI2QkIKzYpkiGny1H3axz1M94ylmNAF sHPcDRKYZGZmBlRgfKRVdk/5wE5e5iqbW2wTqq6esfV7lRhzmONfMGyXqqrKUqJ1YTxZNG27x ykFOqQm7qf+1mpgaSJL9QKZ+maFbMSJiEoEtLcGw8QY0lSUWTjFJjA6JowfKMgk5Yzdfclx3k enQec4gF9wr7FJQf5lBsUCuJVqcMiInSBYT3ZmL5dsAu0kXOG0z7b/ZxEQb3ASrhZAblx9BiB i065C3/m1UzEyFOmOI3AyqjyxY+pwswct1VqG/pM2FdtExfCSdPrjBC9yAzHi3d0KkuRWIH/q oSedUNMqCVMh6jtWMzzI7Mkt5zuSl/xnJBBh5oG6WjX9q8LSgQohoapdRUQ3lojxEAAD6ES/0 AJs7Fzy2kPOJVTo4v2c2hSbteSETjXPlttLFiQlG/iVqj2bmY6NsVtsJhnB1ip/Wj8TF2tK58 zTkCUp0fS7wkdDhIc9KSR2XfqccF2VkQ5U4S9msGNQmloFok8vTURzSsYKkQ4Sns2rR0wFY// i7yv0WFbpXuQd4EaUr6Y2Yg24oc6Nr9NAvlz2d6j1YfzuQpveJbH5YWX1VCqS8v1c01KK1ikB w2nEwMojsavzhY7N1Pcu3e2dKg+BbIBNn32bwszn99FwUUd2S1u50cd8wD4mB4Fo5mWPL2NWr 1/D/NPWhAvHrFCiwbr5B2SeEP5SXnxhOu16L2CMnQ9tcEOK9jIUFOEkHp0WPfqpgHLkf0rrPR 9HqZhXNwc8bR+Z7oE6qOX0AD4cBMNUPpQ97fKdD/pVHpZfyzxm7+IkxeRYHeDeQXiJNsQUVI0 SMLnM9c3aH31ZpJqQq3LljpQi49xilDpZSjY8CcPcH7psoxbwxsSPUIS81xie0ckzU6lJo42R WsBiD9enAMCp9xDjZ3QNWIzl0HLfKVqdLXX6u/gOA/msReL82gGnyqEpiQ0S7k+PR5vvoCL/P vbzs9zkv/hzpNYk1omaaByinFJPHcnOcwsEzhSZW+dzS8NlgnVD3T4GHSiuL5a9BMhlbtk1aK ZIskCZrC4HvaW4/Z8YYFgs/zPd70vuLsS6wG9L7UEbnx+IfCg2v7rWTLnTJJHs3G+kmDY49Gd bovUhfy7dQaVBDch2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use ARRAY_SIZE to replace the hardcoded size so we will never have a mismatch. Signed-off-by: Oscar Carter =2D-- drivers/staging/vt6656/main_usb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/ma= in_usb.c index 5e48b3ddb94c..4370941ffc04 100644 =2D-- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -23,6 +23,7 @@ #include #include +#include #include "device.h" #include "card.h" #include "baseband.h" @@ -116,6 +117,7 @@ static int vnt_init_registers(struct vnt_private *priv= ) int ii; u8 tmp; u8 calib_tx_iq =3D 0, calib_tx_dc =3D 0, calib_rx_iq =3D 0; + const int n_cck_pwr_tbl =3D ARRAY_SIZE(priv->cck_pwr_tbl); dev_dbg(&priv->usb->dev, "---->INIbInitAdapter. [%d][%d]\n", DEVICE_INIT_COLD, priv->packet_type); @@ -145,7 +147,7 @@ static int vnt_init_registers(struct vnt_private *priv= ) init_cmd->init_class =3D DEVICE_INIT_COLD; init_cmd->exist_sw_net_addr =3D priv->exist_sw_net_addr; - for (ii =3D 0; ii < 6; ii++) + for (ii =3D 0; ii < ARRAY_SIZE(init_cmd->sw_net_addr); ii++) init_cmd->sw_net_addr[ii] =3D priv->current_net_addr[ii]; init_cmd->short_retry_limit =3D priv->short_retry_limit; init_cmd->long_retry_limit =3D priv->long_retry_limit; @@ -184,7 +186,7 @@ static int vnt_init_registers(struct vnt_private *priv= ) priv->cck_pwr =3D priv->eeprom[EEP_OFS_PWR_CCK]; priv->ofdm_pwr_g =3D priv->eeprom[EEP_OFS_PWR_OFDMG]; /* load power table */ - for (ii =3D 0; ii < 14; ii++) { + for (ii =3D 0; ii < n_cck_pwr_tbl; ii++) { priv->cck_pwr_tbl[ii] =3D priv->eeprom[ii + EEP_OFS_CCK_PWR_TBL]; if (priv->cck_pwr_tbl[ii] =3D=3D 0) @@ -200,7 +202,7 @@ static int vnt_init_registers(struct vnt_private *priv= ) * original zonetype is USA, but custom zonetype is Europe, * then need to recover 12, 13, 14 channels with 11 channel */ - for (ii =3D 11; ii < 14; ii++) { + for (ii =3D 11; ii < n_cck_pwr_tbl; ii++) { priv->cck_pwr_tbl[ii] =3D priv->cck_pwr_tbl[10]; priv->ofdm_pwr_tbl[ii] =3D priv->ofdm_pwr_tbl[10]; } =2D- 2.20.1