All of lore.kernel.org
 help / color / mirror / Atom feed
* sound/usb/mixer_scarlett_gen2.c:2429:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-09-13 10:38 kernel test robot
  2021-09-14  7:06   ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-09-13 10:38 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17396 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Geoffrey D. Bennett" <g@b4.vu>
CC: Takashi Iwai <tiwai@suse.de>
CC: Vladimir Sadovnikov <sadko4u@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f
commit: d5bda7e03982f67ce2f6c0d79b750fb27077331a ALSA: usb-audio: scarlett2: Add support for the talkback feature
date:   3 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 3 months ago
config: i386-randconfig-c001-20210910 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
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/torvalds/linux.git/commit/?id=d5bda7e03982f67ce2f6c0d79b750fb27077331a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout d5bda7e03982f67ce2f6c0d79b750fb27077331a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           for (i = 0; i < num_mixer_out; i++) {
           ^
   sound/usb/mixer_scarlett_gen2.c:3639:9: note: Calling 'scarlett2_usb_get_mux'
           return scarlett2_usb_get_mux(mixer);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1489:8: note: Calling 'scarlett2_usb'
           err = scarlett2_usb(mixer, SCARLETT2_USB_GET_MUX,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1070:6: note: Assuming 'req' is non-null
           if (!req) {
               ^~~~
   sound/usb/mixer_scarlett_gen2.c:1070:2: note: Taking false branch
           if (!req) {
           ^
   sound/usb/mixer_scarlett_gen2.c:1076:6: note: Assuming 'resp' is non-null
           if (!resp) {
               ^~~~~
   sound/usb/mixer_scarlett_gen2.c:1076:2: note: Taking false branch
           if (!resp) {
           ^
   sound/usb/mixer_scarlett_gen2.c:1087:6: note: 'req_size' is 4
           if (req_size)
               ^~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1087:2: note: Taking true branch
           if (req_size)
           ^
   sound/usb/mixer_scarlett_gen2.c:1093:6: note: Assuming 'err' is equal to 'req_buf_size'
           if (err != req_buf_size) {
               ^~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1093:2: note: Taking false branch
           if (err != req_buf_size) {
           ^
   sound/usb/mixer_scarlett_gen2.c:1110:6: note: Assuming 'err' is equal to 'resp_buf_size'
           if (err != resp_buf_size) {
               ^~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1110:2: note: Taking false branch
           if (err != resp_buf_size) {
           ^
   sound/usb/mixer_scarlett_gen2.c:1123:6: note: Assuming 'resp->cmd' is equal to 'req->cmd'
           if (resp->cmd != req->cmd ||
               ^~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1123:6: note: Left side of '||' is false
   sound/usb/mixer_scarlett_gen2.c:1124:7: note: Assuming 'resp->seq' is equal to 'req->seq'
               (resp->seq != req->seq &&
                ^~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1124:29: note: Left side of '&&' is false
               (resp->seq != req->seq &&
                                      ^
   sound/usb/mixer_scarlett_gen2.c:1126:6: note: Assuming 'resp_size' is equal to field 'size'
               resp_size != le16_to_cpu(resp->size) ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1123:6: note: Left side of '||' is false
           if (resp->cmd != req->cmd ||
               ^
   sound/usb/mixer_scarlett_gen2.c:1127:6: note: Assuming field 'error' is 0
               resp->error ||
               ^~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1123:6: note: Left side of '||' is false
           if (resp->cmd != req->cmd ||
               ^
   sound/usb/mixer_scarlett_gen2.c:1128:6: note: Assuming field 'pad' is 0
               resp->pad) {
               ^~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1123:2: note: Taking false branch
           if (resp->cmd != req->cmd ||
           ^
   sound/usb/mixer_scarlett_gen2.c:1143:6: note: 'resp_data' is non-null
           if (resp_data && resp_size > 0)
               ^~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1143:6: note: Left side of '&&' is true
   sound/usb/mixer_scarlett_gen2.c:1143:19: note: Assuming 'resp_size' is <= 0
           if (resp_data && resp_size > 0)
                            ^~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1143:2: note: Taking false branch
           if (resp_data && resp_size > 0)
           ^
   sound/usb/mixer_scarlett_gen2.c:1151:2: note: Returning without writing to '*resp_data'
           return err;
           ^
   sound/usb/mixer_scarlett_gen2.c:1489:8: note: Returning from 'scarlett2_usb'
           err = scarlett2_usb(mixer, SCARLETT2_USB_GET_MUX,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1492:6: note: Assuming 'err' is >= 0
           if (err < 0)
               ^~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1492:2: note: Taking false branch
           if (err < 0)
           ^
   sound/usb/mixer_scarlett_gen2.c:1495:7: note: The value 0 is assigned to 'i'
           for (i = 0; i < count; i++)
                ^~~~~
   sound/usb/mixer_scarlett_gen2.c:1495:14: note: Assuming 'i' is < 'count'
           for (i = 0; i < count; i++)
                       ^~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:1495:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < count; i++)
           ^
   sound/usb/mixer_scarlett_gen2.c:1496:3: note: 2nd function call argument is an uninitialized value
                   scarlett2_usb_populate_mux(private, le32_to_cpu(data[i]));
                   ^
>> sound/usb/mixer_scarlett_gen2.c:2429:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
                   err = scarlett2_usb_get_config(mixer,
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:2429:3: note: Value stored to 'err' is never read
                   err = scarlett2_usb_get_config(mixer,
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:2433:38: warning: The left operand of '&' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                           private->talkback_map[i] = bitmap & 1;
                                                             ^
   sound/usb/mixer_scarlett_gen2.c:3933:6: note: Assuming field 'protocol' is not equal to 0
           if (!mixer->protocol)
               ^~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:3933:2: note: Taking false branch
           if (!mixer->protocol)
           ^
   sound/usb/mixer_scarlett_gen2.c:3936:6: note: Assuming the condition is false
           if (!(chip->setup & SCARLETT2_ENABLE)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:3936:2: note: Taking false branch
           if (!(chip->setup & SCARLETT2_ENABLE)) {
           ^
   sound/usb/mixer_scarlett_gen2.c:3951:8: note: Calling 'snd_scarlett_gen2_controls_create'
           err = snd_scarlett_gen2_controls_create(mixer);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:3845:9: note: Assuming the condition is true
           while (*info && (*info)->usb_id != mixer->chip->usb_id)
                  ^~~~~
   sound/usb/mixer_scarlett_gen2.c:3845:9: note: Left side of '&&' is true
   sound/usb/mixer_scarlett_gen2.c:3845:18: note: Assuming '(*info)->usb_id' is equal to 'mixer->chip->usb_id'
           while (*info && (*info)->usb_id != mixer->chip->usb_id)
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:3845:2: note: Loop condition is false. Execution continues on line 3847
           while (*info && (*info)->usb_id != mixer->chip->usb_id)
           ^
   sound/usb/mixer_scarlett_gen2.c:3847:2: note: Taking false branch
           if (!*info)
           ^
   sound/usb/mixer_scarlett_gen2.c:3852:6: note: 'err' is >= 0
           if (err < 0)
               ^~~
   sound/usb/mixer_scarlett_gen2.c:3852:2: note: Taking false branch
           if (err < 0)
           ^
   sound/usb/mixer_scarlett_gen2.c:3857:6: note: 'err' is >= 0
           if (err < 0)
               ^~~
   sound/usb/mixer_scarlett_gen2.c:3857:2: note: Taking false branch
           if (err < 0)
           ^
   sound/usb/mixer_scarlett_gen2.c:3861:8: note: Calling 'scarlett2_read_configs'
           err = scarlett2_read_configs(mixer);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:3573:6: note: Assuming field 'has_msd_mode' is 0
           if (info->has_msd_mode) {
               ^~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:3573:2: note: Taking false branch
           if (info->has_msd_mode) {
           ^
   sound/usb/mixer_scarlett_gen2.c:3586:6: note: 'err' is >= 0
           if (err < 0)
               ^~~
   sound/usb/mixer_scarlett_gen2.c:3586:2: note: Taking false branch
           if (err < 0)
           ^
   sound/usb/mixer_scarlett_gen2.c:3589:8: note: Calling 'scarlett2_update_monitor_other'
           err = scarlett2_update_monitor_other(mixer);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:2388:6: note: Assuming field 'direct_monitor' is 0
           if (info->direct_monitor)
               ^~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:2388:2: note: Taking false branch
           if (info->direct_monitor)
           ^
   sound/usb/mixer_scarlett_gen2.c:2396:6: note: Assuming field 'has_speaker_switching' is not equal to 0
           if (!info->has_speaker_switching)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:2396:2: note: Taking false branch
           if (!info->has_speaker_switching)
           ^
   sound/usb/mixer_scarlett_gen2.c:2402:6: note: 'err' is >= 0
           if (err < 0)
               ^~~
   sound/usb/mixer_scarlett_gen2.c:2402:2: note: Taking false branch
           if (err < 0)
           ^
   sound/usb/mixer_scarlett_gen2.c:2408:6: note: 'err' is >= 0
           if (err < 0)
               ^~~
   sound/usb/mixer_scarlett_gen2.c:2408:2: note: Taking false branch
           if (err < 0)
           ^
   sound/usb/mixer_scarlett_gen2.c:2411:6: note: Assuming the condition is true
           if (!monitor_other_enable[0])
               ^~~~~~~~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:2411:2: note: Taking true branch
           if (!monitor_other_enable[0])
           ^
   sound/usb/mixer_scarlett_gen2.c:2416:6: note: Assuming field 'has_talkback' is not equal to 0
           if (info->has_talkback) {
               ^~~~~~~~~~~~~~~~~~
   sound/usb/mixer_scarlett_gen2.c:2416:2: note: Taking true branch

vim +/err +2429 sound/usb/mixer_scarlett_gen2.c

6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2369  
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2370  static int scarlett2_update_monitor_other(struct usb_mixer_interface *mixer)
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2371  {
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2372  	struct scarlett2_data *private = mixer->private_data;
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2373  	const struct scarlett2_device_info *info = private->info;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2374  	int err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2375  
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2376  	/* monitor_other_enable[0] enables speaker switching
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2377  	 * monitor_other_enable[1] enables talkback
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2378  	 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2379  	u8 monitor_other_enable[2];
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2380  
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2381  	/* monitor_other_switch[0] activates the alternate speakers
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2382  	 * monitor_other_switch[1] activates talkback
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2383  	 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2384  	u8 monitor_other_switch[2];
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2385  
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2386  	private->monitor_other_updated = 0;
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2387  
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2388  	if (info->direct_monitor)
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2389  		return scarlett2_usb_get_config(
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2390  			mixer, SCARLETT2_CONFIG_DIRECT_MONITOR,
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2391  			1, &private->direct_monitor_switch);
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2392  
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2393  	/* if it doesn't do speaker switching then it also doesn't do
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2394  	 * talkback
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2395  	 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2396  	if (!info->has_speaker_switching)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2397  		return 0;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2398  
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2399  	err = scarlett2_usb_get_config(
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2400  		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE,
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2401  		2, monitor_other_enable);
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2402  	if (err < 0)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2403  		return err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2404  
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2405  	err = scarlett2_usb_get_config(
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2406  		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH,
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2407  		2, monitor_other_switch);
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2408  	if (err < 0)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2409  		return err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2410  
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2411  	if (!monitor_other_enable[0])
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2412  		private->speaker_switching_switch = 0;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2413  	else
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2414  		private->speaker_switching_switch = monitor_other_switch[0] + 1;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2415  
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2416  	if (info->has_talkback) {
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2417  		const int (*port_count)[SCARLETT2_PORT_DIRNS] =
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2418  			info->port_count;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2419  		int num_mixes =
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2420  			port_count[SCARLETT2_PORT_TYPE_MIX][SCARLETT2_PORT_IN];
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2421  		u16 bitmap;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2422  		int i;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2423  
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2424  		if (!monitor_other_enable[1])
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2425  			private->talkback_switch = 0;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2426  		else
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2427  			private->talkback_switch = monitor_other_switch[1] + 1;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2428  
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23 @2429  		err = scarlett2_usb_get_config(mixer,
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2430  					       SCARLETT2_CONFIG_TALKBACK_MAP,
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2431  					       1, &bitmap);
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2432  		for (i = 0; i < num_mixes; i++, bitmap >>= 1)
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2433  			private->talkback_map[i] = bitmap & 1;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2434  	}
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2435  
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2436  	return 0;
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2437  }
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2438  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39572 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* sound/usb/mixer_scarlett_gen2.c:2429:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
  2021-09-13 10:38 sound/usb/mixer_scarlett_gen2.c:2429:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
@ 2021-09-14  7:06   ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-09-14  7:06 UTC (permalink / raw)
  To: Geoffrey D. Bennett
  Cc: llvm, kbuild-all, linux-kernel, Takashi Iwai, Vladimir Sadovnikov

[-- Attachment #1: Type: text/plain, Size: 7176 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f
commit: d5bda7e03982f67ce2f6c0d79b750fb27077331a ALSA: usb-audio: scarlett2: Add support for the talkback feature
date:   3 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 3 months ago
config: i386-randconfig-c001-20210910 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
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/torvalds/linux.git/commit/?id=d5bda7e03982f67ce2f6c0d79b750fb27077331a
         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
         git fetch --no-tags linus master
         git checkout d5bda7e03982f67ce2f6c0d79b750fb27077331a
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer

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


clang-analyzer warnings: (new ones prefixed by >>)

 >> sound/usb/mixer_scarlett_gen2.c:2429:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
                    err = scarlett2_usb_get_config(mixer,
                    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/err +2429 sound/usb/mixer_scarlett_gen2.c

6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2369
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2370  static int scarlett2_update_monitor_other(struct usb_mixer_interface *mixer)
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2371  {
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2372  	struct scarlett2_data *private = mixer->private_data;
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2373  	const struct scarlett2_device_info *info = private->info;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2374  	int err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2375
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2376  	/* monitor_other_enable[0] enables speaker switching
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2377  	 * monitor_other_enable[1] enables talkback
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2378  	 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2379  	u8 monitor_other_enable[2];
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2380
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2381  	/* monitor_other_switch[0] activates the alternate speakers
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2382  	 * monitor_other_switch[1] activates talkback
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2383  	 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2384  	u8 monitor_other_switch[2];
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2385
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2386  	private->monitor_other_updated = 0;
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2387
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2388  	if (info->direct_monitor)
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2389  		return scarlett2_usb_get_config(
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2390  			mixer, SCARLETT2_CONFIG_DIRECT_MONITOR,
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2391  			1, &private->direct_monitor_switch);
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2392
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2393  	/* if it doesn't do speaker switching then it also doesn't do
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2394  	 * talkback
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2395  	 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2396  	if (!info->has_speaker_switching)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2397  		return 0;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2398
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2399  	err = scarlett2_usb_get_config(
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2400  		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE,
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2401  		2, monitor_other_enable);
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2402  	if (err < 0)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2403  		return err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2404
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2405  	err = scarlett2_usb_get_config(
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2406  		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH,
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2407  		2, monitor_other_switch);
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2408  	if (err < 0)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2409  		return err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2410
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2411  	if (!monitor_other_enable[0])
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2412  		private->speaker_switching_switch = 0;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2413  	else
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2414  		private->speaker_switching_switch = monitor_other_switch[0] + 1;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2415
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2416  	if (info->has_talkback) {
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2417  		const int (*port_count)[SCARLETT2_PORT_DIRNS] =
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2418  			info->port_count;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2419  		int num_mixes =
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2420  			port_count[SCARLETT2_PORT_TYPE_MIX][SCARLETT2_PORT_IN];
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2421  		u16 bitmap;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2422  		int i;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2423
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2424  		if (!monitor_other_enable[1])
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2425  			private->talkback_switch = 0;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2426  		else
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2427  			private->talkback_switch = monitor_other_switch[1] + 1;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2428
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23 @2429  		err = scarlett2_usb_get_config(mixer,
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2430  					       SCARLETT2_CONFIG_TALKBACK_MAP,
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2431  					       1, &bitmap);
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2432  		for (i = 0; i < num_mixes; i++, bitmap >>= 1)
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2433  			private->talkback_map[i] = bitmap & 1;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2434  	}
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2435
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2436  	return 0;
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2437  }
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2438

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39572 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* sound/usb/mixer_scarlett_gen2.c:2429:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
@ 2021-09-14  7:06   ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-09-14  7:06 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 7284 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f
commit: d5bda7e03982f67ce2f6c0d79b750fb27077331a ALSA: usb-audio: scarlett2: Add support for the talkback feature
date:   3 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 3 months ago
config: i386-randconfig-c001-20210910 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
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/torvalds/linux.git/commit/?id=d5bda7e03982f67ce2f6c0d79b750fb27077331a
         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
         git fetch --no-tags linus master
         git checkout d5bda7e03982f67ce2f6c0d79b750fb27077331a
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer

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


clang-analyzer warnings: (new ones prefixed by >>)

 >> sound/usb/mixer_scarlett_gen2.c:2429:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
                    err = scarlett2_usb_get_config(mixer,
                    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/err +2429 sound/usb/mixer_scarlett_gen2.c

6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2369
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2370  static int scarlett2_update_monitor_other(struct usb_mixer_interface *mixer)
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2371  {
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2372  	struct scarlett2_data *private = mixer->private_data;
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2373  	const struct scarlett2_device_info *info = private->info;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2374  	int err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2375
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2376  	/* monitor_other_enable[0] enables speaker switching
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2377  	 * monitor_other_enable[1] enables talkback
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2378  	 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2379  	u8 monitor_other_enable[2];
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2380
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2381  	/* monitor_other_switch[0] activates the alternate speakers
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2382  	 * monitor_other_switch[1] activates talkback
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2383  	 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2384  	u8 monitor_other_switch[2];
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2385
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2386  	private->monitor_other_updated = 0;
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2387
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2388  	if (info->direct_monitor)
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2389  		return scarlett2_usb_get_config(
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2390  			mixer, SCARLETT2_CONFIG_DIRECT_MONITOR,
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2391  			1, &private->direct_monitor_switch);
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2392
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2393  	/* if it doesn't do speaker switching then it also doesn't do
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2394  	 * talkback
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2395  	 */
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2396  	if (!info->has_speaker_switching)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2397  		return 0;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2398
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2399  	err = scarlett2_usb_get_config(
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2400  		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE,
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2401  		2, monitor_other_enable);
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2402  	if (err < 0)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2403  		return err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2404
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2405  	err = scarlett2_usb_get_config(
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2406  		mixer, SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH,
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2407  		2, monitor_other_switch);
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2408  	if (err < 0)
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2409  		return err;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2410
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2411  	if (!monitor_other_enable[0])
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2412  		private->speaker_switching_switch = 0;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2413  	else
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2414  		private->speaker_switching_switch = monitor_other_switch[0] + 1;
e914d8432cb4b9 Geoffrey D. Bennett 2021-06-23  2415
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2416  	if (info->has_talkback) {
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2417  		const int (*port_count)[SCARLETT2_PORT_DIRNS] =
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2418  			info->port_count;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2419  		int num_mixes =
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2420  			port_count[SCARLETT2_PORT_TYPE_MIX][SCARLETT2_PORT_IN];
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2421  		u16 bitmap;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2422  		int i;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2423
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2424  		if (!monitor_other_enable[1])
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2425  			private->talkback_switch = 0;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2426  		else
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2427  			private->talkback_switch = monitor_other_switch[1] + 1;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2428
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23 @2429  		err = scarlett2_usb_get_config(mixer,
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2430  					       SCARLETT2_CONFIG_TALKBACK_MAP,
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2431  					       1, &bitmap);
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2432  		for (i = 0; i < num_mixes; i++, bitmap >>= 1)
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2433  			private->talkback_map[i] = bitmap & 1;
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2434  	}
d5bda7e03982f6 Geoffrey D. Bennett 2021-06-23  2435
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2436  	return 0;
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2437  }
6ef9fa4a0eb4cd Geoffrey D. Bennett 2021-06-23  2438

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39572 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-14  7:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 10:38 sound/usb/mixer_scarlett_gen2.c:2429:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
2021-09-14  7:06 ` kernel test robot
2021-09-14  7:06   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.