mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 12:43:55 +08:00
ALSA: hda/ca0132: fix array_size.cocci warnings
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: 47cdf76e44
("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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
4844f51282
commit
c5f13d75fb
@ -5059,8 +5059,7 @@ static int ca0132_alt_svm_setting_put(struct snd_kcontrol *kcontrol,
|
|||||||
static int ca0132_alt_eq_preset_info(struct snd_kcontrol *kcontrol,
|
static int ca0132_alt_eq_preset_info(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_info *uinfo)
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
unsigned int items = sizeof(ca0132_alt_eq_presets)
|
unsigned int items = ARRAY_SIZE(ca0132_alt_eq_presets);
|
||||||
/ sizeof(struct ct_eq_preset);
|
|
||||||
|
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||||
uinfo->count = 1;
|
uinfo->count = 1;
|
||||||
@ -5089,8 +5088,7 @@ static int ca0132_alt_eq_preset_put(struct snd_kcontrol *kcontrol,
|
|||||||
struct ca0132_spec *spec = codec->spec;
|
struct ca0132_spec *spec = codec->spec;
|
||||||
int i, err = 0;
|
int i, err = 0;
|
||||||
int sel = ucontrol->value.enumerated.item[0];
|
int sel = ucontrol->value.enumerated.item[0];
|
||||||
unsigned int items = sizeof(ca0132_alt_eq_presets)
|
unsigned int items = ARRAY_SIZE(ca0132_alt_eq_presets);
|
||||||
/ sizeof(struct ct_eq_preset);
|
|
||||||
|
|
||||||
if (sel >= items)
|
if (sel >= items)
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user