All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda/ca0132: fix array_size.cocci warnings
  2018-05-14 19:02 [sound:for-next 62/68] sound/pci/hda/patch_ca0132.c:5062:50-51: WARNING: Use ARRAY_SIZE kbuild test robot
@ 2018-05-14 19:02 ` kbuild test robot
  2018-05-14 19:24   ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2018-05-14 19:02 UTC (permalink / raw)
  To: Connor McAdams
  Cc: kbuild-all, alsa-devel, Takashi Iwai, Takashi Sakamoto,
	Jaroslav Kysela, Jérémy Lefaure, linux-kernel

From: Fengguang Wu <fengguang.wu@intel.com>

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 <conmanx360@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [sound:for-next 62/68] sound/pci/hda/patch_ca0132.c:5062:50-51: WARNING: Use ARRAY_SIZE
@ 2018-05-14 19:02 kbuild test robot
  2018-05-14 19:02 ` [PATCH] ALSA: hda/ca0132: fix array_size.cocci warnings kbuild test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2018-05-14 19:02 UTC (permalink / raw)
  To: Connor McAdams; +Cc: Takashi Iwai, alsa-devel, kbuild-all, Takashi Sakamoto

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
head:   4844f51282b60f8a96b05d422f452a785df308b9
commit: 47cdf76e44e87d25b91c0f0d0539944c932941ba [62/68] ALSA: hda/ca0132: Add new control changes for SBZ + R3Di


coccinelle warnings: (new ones prefixed by >>)

>> 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

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: hda/ca0132: fix array_size.cocci warnings
  2018-05-14 19:02 ` [PATCH] ALSA: hda/ca0132: fix array_size.cocci warnings kbuild test robot
@ 2018-05-14 19:24   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2018-05-14 19:24 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Connor McAdams, kbuild-all, alsa-devel, Takashi Sakamoto,
	Jaroslav Kysela, Jérémy Lefaure, linux-kernel

On Mon, 14 May 2018 21:02:14 +0200,
kbuild test robot wrote:
> 
> From: Fengguang Wu <fengguang.wu@intel.com>
> 
> 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 <conmanx360@gmail.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-14 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 19:02 [sound:for-next 62/68] sound/pci/hda/patch_ca0132.c:5062:50-51: WARNING: Use ARRAY_SIZE kbuild test robot
2018-05-14 19:02 ` [PATCH] ALSA: hda/ca0132: fix array_size.cocci warnings kbuild test robot
2018-05-14 19:24   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.