Skip to contentSkip to conversation

sound/usb/mixer_quirks.c:1968:19: sparse: sparse: incorrect type in initializer (different base types)

PATCH kernel test robot 1 participant 1 message Jul 5, 2022 Memory management

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   2a2aa3f05338270aecbe2492fda910d6c17e0102
commit: 4b8ea38fabab45ad911a32a336416062553dfe9c [7518/7896] ALSA: usb-audio: Support jack detection on Dell dock
config: arm-randconfig-s032-20220703 (https://download.01.org/0day-ci/archive/20220705/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=4b8ea38fabab45ad911a32a336416062553dfe9c
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 4b8ea38fabab45ad911a32a336416062553dfe9c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash sound/usb/

If you fix the issue, kindly add following tag where applicable

sparse warnings: (new ones prefixed by >>)

>> sound/usb/mixer_quirks.c:1968:19: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned int [usertype] buf @@     got restricted __be32 [usertype] @@
   sound/usb/mixer_quirks.c:1968:19: sparse:     expected unsigned int [usertype] buf
   sound/usb/mixer_quirks.c:1968:19: sparse:     got restricted __be32 [usertype]
   sound/usb/mixer_quirks.c:1979:19: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned int [usertype] buf @@     got restricted __be32 [usertype] @@
   sound/usb/mixer_quirks.c:1979:19: sparse:     expected unsigned int [usertype] buf
   sound/usb/mixer_quirks.c:1979:19: sparse:     got restricted __be32 [usertype]
>> sound/usb/mixer_quirks.c:1992:18: sparse: sparse: cast to restricted __be32

vim +1968 sound/usb/mixer_quirks.c

1964
1965 static int realtek_hda_set(struct snd_usb_audio *chip, u32 cmd)
1966 {
1967 struct usb_device *dev = chip->dev;

> 1968		u32 buf = cpu_to_be32(cmd);
  1969	
  1970		return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), REALTEK_HDA_SET,
  1971				       USB_RECIP_DEVICE | USB_TYPE_VENDOR | USB_DIR_OUT,
  1972				       REALTEK_HDA_VALUE, 0, &buf, sizeof(buf));
  1973	}
  1974	
  1975	static int realtek_hda_get(struct snd_usb_audio *chip, u32 cmd, u32 *value)
  1976	{
  1977		struct usb_device *dev = chip->dev;
  1978		int err;
  1979		u32 buf = cpu_to_be32(cmd);
  1980	
  1981		err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), REALTEK_HDA_GET_OUT,
  1982				      USB_RECIP_DEVICE | USB_TYPE_VENDOR | USB_DIR_OUT,
  1983				      REALTEK_HDA_VALUE, 0, &buf, sizeof(buf));
  1984		if (err < 0)
  1985			return err;
  1986		err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), REALTEK_HDA_GET_IN,
  1987				      USB_RECIP_DEVICE | USB_TYPE_VENDOR | USB_DIR_IN,
  1988				      REALTEK_HDA_VALUE, 0, &buf, sizeof(buf));
  1989		if (err < 0)
  1990			return err;
  1991	
> 1992		*value = be32_to_cpu(buf);

1993 return 0;
1994 }
1995

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp