From patchwork Mon May 14 19:02:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kernel test robot X-Patchwork-Id: 10399133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 81116600D2 for ; Mon, 14 May 2018 19:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C7A927FA1 for ; Mon, 14 May 2018 19:03:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20BB32821F; Mon, 14 May 2018 19:03:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FC5527FA1 for ; Mon, 14 May 2018 19:03:44 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6D95E26706F; Mon, 14 May 2018 21:03:29 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id EBEBE266F69; Mon, 14 May 2018 21:03:25 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by alsa0.perex.cz (Postfix) with ESMTP id A4DB5266F4E for ; Mon, 14 May 2018 21:03:19 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2018 12:03:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,401,1520924400"; d="scan'208";a="40872273" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by orsmga007.jf.intel.com with ESMTP; 14 May 2018 12:03:12 -0700 Received: from kbuild by bee with local (Exim 4.84_2) (envelope-from ) id 1fIIka-0000wv-04; Tue, 15 May 2018 03:03:12 +0800 Date: Tue, 15 May 2018 03:02:14 +0800 From: kbuild test robot To: Connor McAdams Message-ID: <20180514190214.GA38036@athens> References: <201805150307.Eek1tvZf%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201805150307.Eek1tvZf%fengguang.wu@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Cc: alsa-devel@alsa-project.org, Takashi Iwai , linux-kernel@vger.kernel.org, kbuild-all@01.org, =?iso-8859-1?B?Suly6W15?= Lefaure , Takashi Sakamoto Subject: [alsa-devel] [PATCH] ALSA: hda/ca0132: fix array_size.cocci warnings X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fengguang Wu sound/pci/hda/patch_ca0132.c:5062:50-51: WARNING: Use ARRAY_SIZE sound/pci/hda/patch_ca0132.c:5092:50-51: WARNING: Use ARRAY_SIZE Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element Semantic patch information: This makes an effort to find cases where ARRAY_SIZE can be used such as where there is a division of sizeof the array by the sizeof its first element or by any indexed element or the element type. It replaces the division of the two sizeofs by ARRAY_SIZE. Generated by: scripts/coccinelle/misc/array_size.cocci Fixes: 47cdf76e44e8 ("ALSA: hda/ca0132: Add new control changes for SBZ + R3Di") CC: Connor McAdams Signed-off-by: Fengguang Wu --- patch_ca0132.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -5059,8 +5059,7 @@ static int ca0132_alt_svm_setting_put(st static int ca0132_alt_eq_preset_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - unsigned int items = sizeof(ca0132_alt_eq_presets) - / sizeof(struct ct_eq_preset); + unsigned int items = ARRAY_SIZE(ca0132_alt_eq_presets); uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; @@ -5089,8 +5088,7 @@ static int ca0132_alt_eq_preset_put(stru struct ca0132_spec *spec = codec->spec; int i, err = 0; int sel = ucontrol->value.enumerated.item[0]; - unsigned int items = sizeof(ca0132_alt_eq_presets) - / sizeof(struct ct_eq_preset); + unsigned int items = ARRAY_SIZE(ca0132_alt_eq_presets); if (sel >= items) return 0;