[tiwai-sound:topic/midi20 11/36] sound/usb/midi2.c:826:59: warning: variable 'type' is uninitialized when used here
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git topic/midi20 head: 9e08987ec08f99983e56b33fa1762a57b6216b2a commit: a9822209474cc230d43b7df9833b25cb3c544b6f [11/36] ALSA: usb-audio: Create UMP blocks from USB MIDI GTBs config: hexagon-allmodconfig compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project b0fb98227c90adf2536c9ad644a74d5e92961111) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=a... git remote add tiwai-sound https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git git fetch --no-tags tiwai-sound topic/midi20 git checkout a9822209474cc230d43b7df9833b25cb3c544b6f # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/tty/serial/ sound/core/ sound/usb/
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202305211230.xsXqNmFC-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from sound/usb/midi2.c:10: In file included from include/linux/usb.h:16: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from sound/usb/midi2.c:10: In file included from include/linux/usb.h:16: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from sound/usb/midi2.c:10: In file included from include/linux/usb.h:16: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^
sound/usb/midi2.c:826:59: warning: variable 'type' is uninitialized when used here [-Wuninitialized]
usb_audio_dbg(umidi->chip, "Unsupported GTB type %d\n", type); ^~~~ sound/usb/usbaudio.h:79:36: note: expanded from macro 'usb_audio_dbg' dev_dbg(&(chip)->dev->dev, fmt, ##args) ^~~~ include/linux/dev_printk.h:155:39: note: expanded from macro 'dev_dbg' dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/dynamic_debug.h:272:19: note: expanded from macro 'dynamic_dev_dbg' dev, fmt, ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/dynamic_debug.h:248:59: note: expanded from macro '_dynamic_func_call' _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/dynamic_debug.h:246:65: note: expanded from macro '_dynamic_func_call_cls' __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/dynamic_debug.h:222:15: note: expanded from macro '__dynamic_func_call_cls' func(&id, ##__VA_ARGS__); \ ^~~~~~~~~~~ sound/usb/midi2.c:801:10: note: initialize the variable 'type' to silence this warning int type, err; ^ = 0 7 warnings generated.
vim +/type +826 sound/usb/midi2.c
794 795 /* create a UMP block from a GTB entry */ 796 static int create_gtb_block(struct snd_usb_midi2_ump *rmidi, int dir, int blk) 797 { 798 struct snd_usb_midi2_interface *umidi = rmidi->umidi; 799 const struct usb_ms20_gr_trm_block_descriptor *desc; 800 struct snd_ump_block *fb; 801 int type, err; 802 803 desc = find_group_terminal_block(umidi, blk); 804 if (!desc) 805 return 0; 806 807 usb_audio_dbg(umidi->chip, 808 "GTB %d: type=%d, group=%d/%d, protocol=%d, in bw=%d, out bw=%d\n", 809 blk, desc->bGrpTrmBlkType, desc->nGroupTrm, 810 desc->nNumGroupTrm, desc->bMIDIProtocol, 811 __le16_to_cpu(desc->wMaxInputBandwidth), 812 __le16_to_cpu(desc->wMaxOutputBandwidth)); 813 814 /* assign the direction */ 815 switch (desc->bGrpTrmBlkType) { 816 case USB_MS_GR_TRM_BLOCK_TYPE_BIDIRECTIONAL: 817 type = SNDRV_UMP_DIR_BIDIRECTION; 818 break; 819 case USB_MS_GR_TRM_BLOCK_TYPE_INPUT_ONLY: 820 type = SNDRV_UMP_DIR_INPUT; 821 break; 822 case USB_MS_GR_TRM_BLOCK_TYPE_OUTPUT_ONLY: 823 type = SNDRV_UMP_DIR_OUTPUT; 824 break; 825 default:
826 usb_audio_dbg(umidi->chip, "Unsupported GTB type %d\n", type);
827 return 0; /* unsupported */ 828 } 829 830 /* guess work: set blk-1 as the (0-based) block ID */ 831 err = snd_ump_block_new(rmidi->ump, blk - 1, type, 832 desc->nGroupTrm, desc->nNumGroupTrm, 833 &fb); 834 if (err == -EBUSY) 835 return 0; /* already present */ 836 else if (err) 837 return err; 838 839 if (desc->iBlockItem) 840 usb_string(rmidi->dev, desc->iBlockItem, 841 fb->info.name, sizeof(fb->info.name)); 842 843 if (__le16_to_cpu(desc->wMaxInputBandwidth) == 1 || 844 __le16_to_cpu(desc->wMaxOutputBandwidth) == 1) 845 fb->info.flags |= SNDRV_UMP_BLOCK_IS_MIDI1 | 846 SNDRV_UMP_BLOCK_IS_LOWSPEED; 847 848 usb_audio_dbg(umidi->chip, 849 "Created a UMP block %d from GTB, name=%s\n", 850 blk, fb->info.name); 851 return 0; 852 } 853
participants (1)
-
kernel test robot