Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp874364ybh; Wed, 18 Mar 2020 10:41:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsPJkLxfSmRRQelfmfNDmk7cn2bDg3JBlKEz/KxO5SJZAI/6Pkj3pfdusPsfpxQ8hXJINoy X-Received: by 2002:a9d:de8:: with SMTP id 95mr5033538ots.160.1584553301319; Wed, 18 Mar 2020 10:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584553301; cv=none; d=google.com; s=arc-20160816; b=DsAuM/UrbT2ROLstcvMxPpYlWNO07YWefPwgcQN8hWoj5Kh52Ckq7lT7bBaryMXy7x PrhMSw8ZfrA51sZ52rjDQEvBg5GSfQtXY5K6sCj0vr8nmxshbB3PX6Xi8MUeIUz8jkvd bnNul84WDAzp0ic366vRqy9RizilP4AXqiWdUOEmwPTw0vy0ZxGwecIhF51yoNxWBs4x PupKIHPyZzWOySu6laAdxkrmgCC95Ii8n75yoh46rNQL1QMkCVx3qLlat+kmkZl0Cao/ /ocbfZ8SeDV8wKJLwoRfNfri35i/+qo9CexvczUrd3uvTT5bDRl+21JknnAeYoqWjGz/ We8A== 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=fmDTKpGW5JPalS+2NNYQ3VuLqNb/BmLBdT2GkgIkRHE=; b=NWJZ7ruiNLnaBRVzfCMD0doNb33/DmivRhuk0q/UGzNI4VmhglPPri4XFZ89efYCpm XBB7CNCRBwcl2BHzX2BQEYiT20E6JUJUKNTAYwLh4/uctFxxHW2urndzEMiPljBbgM5K lnmbOYkIQRJOtiGqZlOTgmRhE7aNLr4CbTHP/vf61kJ4AeU0kBDH3mOnRJjSyTsQf76j hKAvvqslerKAoctKD7ggyNGmCPGQWgR3D1bHxwqo8wn3DpKB7kFwShRAeRxcj2C0ZCCM MbQmqZOd6sBzdaLkgg+HpOmwwcD8B6dDBwaaZkV+H0XlyqnjY25adcv/uPJTbuCZ0Mno Jr2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=Vnjc0av1; 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 k201si3970756oib.94.2020.03.18.10.41.29; Wed, 18 Mar 2020 10:41:41 -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=Vnjc0av1; 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 S1726647AbgCRRlK (ORCPT + 99 others); Wed, 18 Mar 2020 13:41:10 -0400 Received: from mout.gmx.net ([212.227.15.18]:45143 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbgCRRlK (ORCPT ); Wed, 18 Mar 2020 13:41:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1584553260; bh=vCgXZ2I+Xf8X2pR7gWvHEO+dE4EhgtLquAj/ck7xEj8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=Vnjc0av1x3dyOYUm1G/PujvpeZYIxuWq5g0K5EM1+bvDSRx97FEIyTPrlb0kwY3JO cyOwYS2kLNsdSTPnvvj0Ldm1s/Ax7tK7PnGiHOtTLL4ySA+d0Cfcb1U1wlkL7zYPCI oPqk0mkwTKn7k8JqhaVhg9Sp1qVCL9F9a7x+hb2A= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([83.52.229.196]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MgNh7-1jmYSq3rBv-00hyB0; Wed, 18 Mar 2020 18:41:00 +0100 From: Oscar Carter To: Forest Bond , Greg Kroah-Hartman Cc: Quentin Deslandes , Malcolm Priestley , Oscar Carter , Colin Ian King , Gabriela Bittencourt , Dan Carpenter , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] staging: vt6656: Use ARRAY_SIZE instead of hardcoded size Date: Wed, 18 Mar 2020 18:40:15 +0100 Message-Id: <20200318174015.7515-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:3Kz+2ZK4OkT6fKoYDfLfppenzBOKnJHXnSZKnWuc2wQdKuuSwgZ LC7YodICd25iZrsFRfAefnR1nwcvgWMJRL83EWkr2AlFfxdcBUpBmw8z5LGAuKbTBxEekPu cuhwcore9TN9yZRzgKZ7KtzQZUw4u+RoQT3ufB5V4eLBa4yNXTAocMGTRtXWWfDV9oVqZzK A/6CatuXREpwgHSSz1LDA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:h0lERaXlW6w=:LJHAJpG0QQhm7qQW5MIU2W vQ+W+2gzCPTT5SB/X/gU88eOYBHO07m1KgH8hhpaIcBe08pYO7dRN6QZ5Hobu/RCR5GYZ01zR P6Tt6eY3CWToJgq1vZBKeHMHKVW1IRxUmKWkSTu1YHPZJ7HCilW7NJqEjSlfZds53dCHy38I1 Ne9myH0rDQY/1FI/JPnlEIemlkIHYmzwxRhyhBWsevC/5f7YuilKg9DEq9su1JaRyzYPgUE0u zgHIW44TsadL3lkaFmcPgKhB32soxBDy7yXlsFiQfFC5PDxSsbCMwBy3FsbfVrTnsXweJO8tx BqlBfyssM5r3KUjfOTr9cNQ7EXwJueeRMY1DDCef7yeGV714dYtZ3Shr7S820t/ck6QHyRgZ4 l9QAum7kjtV+PAuyH4/FQgPvwys2Fl53hkTfa9CESDTSUp1eqP6MEuuZMCbNvGLHOBlgZBxUu hZZlXa39A1B+hARBRxpdq9Hpi9Vkw6Xwkg+V7L2qmRnw7EOZkUUN4AxVMLoOZOJX8e8Bh1xph i9UXQYAGM0SNjZTgsqtWKA8vS1v+vXXAS0FyrYoySqQEBiGC4jg7GX0Gq1staQftKlaq65xUJ sTbkhDI4sCVjqLpSzEf2+orp8+pIruLsGNqzFzW10FfEu/5MUDLKsTCiEGm/KkrkUFWIPidhE ZW4z/+BuZGUxSEj13CziCEPo+Wc2kZD5jKQ/wv8WqArWQQwm7lAR+pfoVWhr9rGBdBRPdyDcL gE5dM5f/F1jP93kjzy0nkR7NkQeOcYGf0D5bCOY81TsEPc/LehHZk4naBBT22Wq27xsJvcvtE qBZp98MdjWZni8nL27ZUjhLFhk1TkeE4z/guwCT72ZG6GB0vLF8RvCJqLQyUYyGHSdTYX7Xck XbfdDwHyclf/mQ/6RbQsU/nLGFKWqeERX+oLJjoVj8afThI2IQpe3P6KjbeiFyh+/vtULz9Xc nEq/yAEretjrWwbR+dQf67pyKt/3vBjPJfoKCf+uIke5oRJiNcsDfKonGD7ljD5P+gyPG0dgf vk/7iOVxtQ0SFMfm/va+3yaaDiCzeuo/T8lpFf1Lqhpp3dCtGrtClt6sthR7g+/JqOUaKj52C XRpSKGnmDzGSVdczoroMl59+HLwAqj6FVgNlZaHyEwdJehnAPNZXpeG7ug8OofRoT/XTKcR3N SwourUVrIriE3hOPWuGfszqhl3KlzYykplK9UDG0VvAvQuSJsyT9NCOmW6NgUmiOduWI8zN1P HKfrbqiKZsYejCKP0 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-- Changelog v1 -> v2 - Use ARRAY_SIZE(priv->cck_pwr_tbl) everywhere instead of introducing a ne= w variable to hold its value. drivers/staging/vt6656/main_usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/ma= in_usb.c index 5e48b3ddb94c..acfcc11c3b61 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" @@ -145,7 +146,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 +185,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 < ARRAY_SIZE(priv->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 +201,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 < ARRAY_SIZE(priv->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