From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752061AbeENTDQ (ORCPT ); Mon, 14 May 2018 15:03:16 -0400 Received: from mga06.intel.com ([134.134.136.31]:55622 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbeENTDO (ORCPT ); Mon, 14 May 2018 15:03:14 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,401,1520924400"; d="scan'208";a="40872273" Date: Tue, 15 May 2018 03:02:14 +0800 From: kbuild test robot To: Connor McAdams Cc: kbuild-all@01.org, alsa-devel@alsa-project.org, Takashi Iwai , Takashi Sakamoto , Jaroslav Kysela , =?iso-8859-1?B?Suly6W15?= Lefaure , linux-kernel@vger.kernel.org Subject: [PATCH] ALSA: hda/ca0132: fix array_size.cocci warnings Message-ID: <20180514190214.GA38036@athens> References: <201805150307.Eek1tvZf%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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;