* [geoffreybennett-scarlett-gen2:scarlett2 1/1] sound/usb/mixer_scarlett2.c:7962:27: warning: result of comparison of constant -1 with expression of type 'const u8' (aka 'const unsigned char') is always true
@ 2024-05-11 7:04 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-05-11 7:04 UTC (permalink / raw)
To: Geoffrey D. Bennett; +Cc: llvm, oe-kbuild-all
tree: https://github.com/geoffreybennett/scarlett-gen2.git scarlett2
head: 480eafc2d57158b29e8e5efa5b1ac8b5e5a01af8
commit: 480eafc2d57158b29e8e5efa5b1ac8b5e5a01af8 [1/1] ALSA: scarlett2: Add S/PDIF source selection controls
config: arm-defconfig (https://download.01.org/0day-ci/archive/20240511/202405111415.lB7tVmMM-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240511/202405111415.lB7tVmMM-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405111415.lB7tVmMM-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> sound/usb/mixer_scarlett2.c:7962:27: warning: result of comparison of constant -1 with expression of type 'const u8' (aka 'const unsigned char') is always true [-Wtautological-constant-out-of-range-compare]
for (i = 0; *mode_values != -1; i++, mode_values++)
~~~~~~~~~~~~ ^ ~~
>> sound/usb/mixer_scarlett2.c:8016:43: warning: result of comparison of constant -1 with expression of type 'const u8' (aka 'const unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
if (private->info->spdif_mode_values[i] == -1) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
2 warnings generated.
vim +7962 sound/usb/mixer_scarlett2.c
7944
7945 static int scarlett2_update_spdif_mode(struct usb_mixer_interface *mixer)
7946 {
7947 struct scarlett2_data *private = mixer->private_data;
7948 int err, i;
7949 u8 mode;
7950 const u8 *mode_values = private->info->spdif_mode_values;
7951
7952 if (!private->info->spdif_mode_control_name)
7953 return 0;
7954
7955 err = scarlett2_usb_get_config(mixer, SCARLETT2_CONFIG_SPDIF_MODE,
7956 1, &mode);
7957 if (err < 0)
7958 return err;
7959
7960 private->spdif_mode = 0;
7961
> 7962 for (i = 0; *mode_values != -1; i++, mode_values++)
7963 if (*mode_values == mode) {
7964 private->spdif_mode = i;
7965 break;
7966 }
7967
7968 return 0;
7969 }
7970
7971 static int scarlett2_spdif_mode_ctl_info(struct snd_kcontrol *kctl,
7972 struct snd_ctl_elem_info *uinfo)
7973 {
7974 struct usb_mixer_elem_info *elem = kctl->private_data;
7975 struct scarlett2_data *private = elem->head.mixer->private_data;
7976 const char * const *mode_texts = private->info->spdif_mode_texts;
7977 int count = 0;
7978
7979 while (*mode_texts++)
7980 count++;
7981
7982 return snd_ctl_enum_info(uinfo, 1, count,
7983 private->info->spdif_mode_texts);
7984 }
7985
7986 static int scarlett2_spdif_mode_ctl_get(struct snd_kcontrol *kctl,
7987 struct snd_ctl_elem_value *ucontrol)
7988 {
7989 struct usb_mixer_elem_info *elem = kctl->private_data;
7990 struct scarlett2_data *private = elem->head.mixer->private_data;
7991
7992 ucontrol->value.enumerated.item[0] = private->spdif_mode;
7993 return 0;
7994 }
7995
7996 static int scarlett2_spdif_mode_ctl_put(struct snd_kcontrol *kctl,
7997 struct snd_ctl_elem_value *ucontrol)
7998 {
7999 struct usb_mixer_elem_info *elem = kctl->private_data;
8000 struct usb_mixer_interface *mixer = elem->head.mixer;
8001 struct scarlett2_data *private = mixer->private_data;
8002 int oval, val, err = 0;
8003 int i;
8004
8005 mutex_lock(&private->data_mutex);
8006
8007 oval = private->spdif_mode;
8008 val = ucontrol->value.enumerated.item[0];
8009
8010 if (val < 0) {
8011 err = -EINVAL;
8012 goto unlock;
8013 }
8014
8015 for (i = 0; i <= val; i++)
> 8016 if (private->info->spdif_mode_values[i] == -1) {
8017 err = -EINVAL;
8018 goto unlock;
8019 }
8020
8021 if (oval == val)
8022 goto unlock;
8023
8024 private->spdif_mode = val;
8025
8026 err = scarlett2_usb_set_config(
8027 mixer, SCARLETT2_CONFIG_SPDIF_MODE, 0,
8028 private->info->spdif_mode_values[val]);
8029 if (!err)
8030 err = 1;
8031
8032 unlock:
8033 mutex_unlock(&private->data_mutex);
8034 return err;
8035 }
8036
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-11 7:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-11 7:04 [geoffreybennett-scarlett-gen2:scarlett2 1/1] sound/usb/mixer_scarlett2.c:7962:27: warning: result of comparison of constant -1 with expression of type 'const u8' (aka 'const unsigned char') is always true kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox