[sound:test/usb-hacks 14/20] sound/usb/pcm.c:579:35: warning: variable 'altsd' set but not used

kernel test robot lkp at intel.com
Tue Nov 10 05:35:20 CET 2020


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git test/usb-hacks
head:   2adedc89c82670019ee3b016d2a2237176768e3a
commit: 7502ae0cddc65ab020cd3c3dc4085f3e70f70f21 [14/20] ALSA: usb-audio: Track implicit fb sync endpoint in audioformat list
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=7502ae0cddc65ab020cd3c3dc4085f3e70f70f21
        git remote add sound https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
        git fetch --no-tags sound test/usb-hacks
        git checkout 7502ae0cddc65ab020cd3c3dc4085f3e70f70f21
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   sound/usb/pcm.c: In function 'set_format':
>> sound/usb/pcm.c:579:35: warning: variable 'altsd' set but not used [-Wunused-but-set-variable]
     579 |  struct usb_interface_descriptor *altsd;
         |                                   ^~~~~

vim +/altsd +579 sound/usb/pcm.c

71bb64c56d787a Eldad Zack    2013-08-03  571  
71bb64c56d787a Eldad Zack    2013-08-03  572  /*
71bb64c56d787a Eldad Zack    2013-08-03  573   * find a matching format and set up the interface
71bb64c56d787a Eldad Zack    2013-08-03  574   */
71bb64c56d787a Eldad Zack    2013-08-03  575  static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
71bb64c56d787a Eldad Zack    2013-08-03  576  {
71bb64c56d787a Eldad Zack    2013-08-03  577  	struct usb_device *dev = subs->dev;
71bb64c56d787a Eldad Zack    2013-08-03  578  	struct usb_host_interface *alts;
71bb64c56d787a Eldad Zack    2013-08-03 @579  	struct usb_interface_descriptor *altsd;
71bb64c56d787a Eldad Zack    2013-08-03  580  	struct usb_interface *iface;
71bb64c56d787a Eldad Zack    2013-08-03  581  	int err;
71bb64c56d787a Eldad Zack    2013-08-03  582  
71bb64c56d787a Eldad Zack    2013-08-03  583  	iface = usb_ifnum_to_if(dev, fmt->iface);
71bb64c56d787a Eldad Zack    2013-08-03  584  	if (WARN_ON(!iface))
71bb64c56d787a Eldad Zack    2013-08-03  585  		return -EINVAL;
b099b9693d23d0 Takashi Iwai  2018-05-02  586  	alts = usb_altnum_to_altsetting(iface, fmt->altsetting);
0141254b0a74b3 Johan Hovold  2019-12-20  587  	if (WARN_ON(!alts))
71bb64c56d787a Eldad Zack    2013-08-03  588  		return -EINVAL;
0141254b0a74b3 Johan Hovold  2019-12-20  589  	altsd = get_iface_desc(alts);
71bb64c56d787a Eldad Zack    2013-08-03  590  
92adc96f8eecd9 Hui Wang      2019-12-18  591  	if (fmt == subs->cur_audiofmt && !subs->need_setup_fmt)
71bb64c56d787a Eldad Zack    2013-08-03  592  		return 0;
71bb64c56d787a Eldad Zack    2013-08-03  593  
71bb64c56d787a Eldad Zack    2013-08-03  594  	/* close the old interface */
92adc96f8eecd9 Hui Wang      2019-12-18  595  	if (subs->interface >= 0 && (subs->interface != fmt->iface || subs->need_setup_fmt)) {
8a463225b11047 Takashi Iwai  2018-05-02  596  		if (!subs->stream->chip->keep_iface) {
71bb64c56d787a Eldad Zack    2013-08-03  597  			err = usb_set_interface(subs->dev, subs->interface, 0);
71bb64c56d787a Eldad Zack    2013-08-03  598  			if (err < 0) {
0ba41d917eeb87 Takashi Iwai  2014-02-26  599  				dev_err(&dev->dev,
0ba41d917eeb87 Takashi Iwai  2014-02-26  600  					"%d:%d: return to setting 0 failed (%d)\n",
0ba41d917eeb87 Takashi Iwai  2014-02-26  601  					fmt->iface, fmt->altsetting, err);
71bb64c56d787a Eldad Zack    2013-08-03  602  				return -EIO;
71bb64c56d787a Eldad Zack    2013-08-03  603  			}
8a463225b11047 Takashi Iwai  2018-05-02  604  		}
71bb64c56d787a Eldad Zack    2013-08-03  605  		subs->interface = -1;
71bb64c56d787a Eldad Zack    2013-08-03  606  		subs->altset_idx = 0;
71bb64c56d787a Eldad Zack    2013-08-03  607  	}
71bb64c56d787a Eldad Zack    2013-08-03  608  
92adc96f8eecd9 Hui Wang      2019-12-18  609  	if (subs->need_setup_fmt)
92adc96f8eecd9 Hui Wang      2019-12-18  610  		subs->need_setup_fmt = false;
92adc96f8eecd9 Hui Wang      2019-12-18  611  
71bb64c56d787a Eldad Zack    2013-08-03  612  	/* set interface */
b099b9693d23d0 Takashi Iwai  2018-05-02  613  	if (iface->cur_altsetting != alts) {
6874daad4b0fbe Jurgen Kramer 2014-11-28  614  		err = snd_usb_select_mode_quirk(subs, fmt);
6874daad4b0fbe Jurgen Kramer 2014-11-28  615  		if (err < 0)
6874daad4b0fbe Jurgen Kramer 2014-11-28  616  			return -EIO;
6874daad4b0fbe Jurgen Kramer 2014-11-28  617  
71bb64c56d787a Eldad Zack    2013-08-03  618  		err = usb_set_interface(dev, fmt->iface, fmt->altsetting);
71bb64c56d787a Eldad Zack    2013-08-03  619  		if (err < 0) {
0ba41d917eeb87 Takashi Iwai  2014-02-26  620  			dev_err(&dev->dev,
0ba41d917eeb87 Takashi Iwai  2014-02-26  621  				"%d:%d: usb_set_interface failed (%d)\n",
0ba41d917eeb87 Takashi Iwai  2014-02-26  622  				fmt->iface, fmt->altsetting, err);
71bb64c56d787a Eldad Zack    2013-08-03  623  			return -EIO;
71bb64c56d787a Eldad Zack    2013-08-03  624  		}
0ba41d917eeb87 Takashi Iwai  2014-02-26  625  		dev_dbg(&dev->dev, "setting usb interface %d:%d\n",
71bb64c56d787a Eldad Zack    2013-08-03  626  			fmt->iface, fmt->altsetting);
71bb64c56d787a Eldad Zack    2013-08-03  627  		snd_usb_set_interface_quirk(dev);
71bb64c56d787a Eldad Zack    2013-08-03  628  	}
71bb64c56d787a Eldad Zack    2013-08-03  629  
b099b9693d23d0 Takashi Iwai  2018-05-02  630  	subs->interface = fmt->iface;
b099b9693d23d0 Takashi Iwai  2018-05-02  631  	subs->altset_idx = fmt->altset_idx;
71bb64c56d787a Eldad Zack    2013-08-03  632  	subs->data_endpoint = snd_usb_add_endpoint(subs->stream->chip,
71bb64c56d787a Eldad Zack    2013-08-03  633  						   alts, fmt->endpoint, subs->direction,
71bb64c56d787a Eldad Zack    2013-08-03  634  						   SND_USB_ENDPOINT_TYPE_DATA);
71bb64c56d787a Eldad Zack    2013-08-03  635  
71bb64c56d787a Eldad Zack    2013-08-03  636  	if (!subs->data_endpoint)
71bb64c56d787a Eldad Zack    2013-08-03  637  		return -EINVAL;
71bb64c56d787a Eldad Zack    2013-08-03  638  
7502ae0cddc65a Takashi Iwai  2020-11-05  639  	err = set_sync_endpoint(subs, fmt);
71bb64c56d787a Eldad Zack    2013-08-03  640  	if (err < 0)
71bb64c56d787a Eldad Zack    2013-08-03  641  		return err;
71bb64c56d787a Eldad Zack    2013-08-03  642  
d133f2c22e9cb7 Eldad Zack    2013-08-03  643  	err = snd_usb_init_pitch(subs->stream->chip, fmt->iface, alts, fmt);
d133f2c22e9cb7 Eldad Zack    2013-08-03  644  	if (err < 0)
e5779998bf8b70 Daniel Mack   2010-03-04  645  		return err;
e5779998bf8b70 Daniel Mack   2010-03-04  646  
e5779998bf8b70 Daniel Mack   2010-03-04  647  	subs->cur_audiofmt = fmt;
e5779998bf8b70 Daniel Mack   2010-03-04  648  
e5779998bf8b70 Daniel Mack   2010-03-04  649  	snd_usb_set_format_quirk(subs, fmt);
e5779998bf8b70 Daniel Mack   2010-03-04  650  
e5779998bf8b70 Daniel Mack   2010-03-04  651  	return 0;
e5779998bf8b70 Daniel Mack   2010-03-04  652  }
e5779998bf8b70 Daniel Mack   2010-03-04  653  

:::::: The code at line 579 was first introduced by commit
:::::: 71bb64c56d787a221752b1de034fe8c07c737f5c ALSA: usb-audio: separate sync endpoint setting from set_format

:::::: TO: Eldad Zack <eldad at fogrefinery.com>
:::::: CC: Takashi Iwai <tiwai at suse.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 75939 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20201110/ae1752cc/attachment-0001.gz>


More information about the Alsa-devel mailing list