sound/usb/mixer_scarlett_gen2.c:2429:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]

From: kernel test robot
Date: Tue Sep 14 2021 - 03:07:14 EST


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@xxxxxxxxx>


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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip