Re: [PATCH] ALSA: PCM: Fix codestyle issues in pcm_native.c

From: kernel test robot
Date: Wed May 10 2023 - 05:43:34 EST


Hi Ivan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on tiwai-sound/for-linus linus/master v6.4-rc1 next-20230510]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Ivan-Orlov/ALSA-PCM-Fix-codestyle-issues-in-pcm_native-c/20230510-152814
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20230510072726.435247-1-ivan.orlov0322%40gmail.com
patch subject: [PATCH] ALSA: PCM: Fix codestyle issues in pcm_native.c
config: csky-randconfig-r004-20230509 (https://download.01.org/0day-ci/archive/20230510/202305101732.PILWtd0A-lkp@xxxxxxxxx/config)
compiler: csky-linux-gcc (GCC) 12.1.0
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://github.com/intel-lab-lkp/linux/commit/6099cbeae29e29487828a858f8b0e866bec90ab1
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Ivan-Orlov/ALSA-PCM-Fix-codestyle-issues-in-pcm_native-c/20230510-152814
git checkout 6099cbeae29e29487828a858f8b0e866bec90ab1
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=csky olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=csky SHELL=/bin/bash sound/core/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202305101732.PILWtd0A-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

sound/core/pcm_native.c: In function 'snd_pcm_hw_params_choose':
>> sound/core/pcm_native.c:660:94: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
660 | trace_hw_mask_param(pcm, *v, 0, &old_mask, hw_param_mask(params, *v));
| ^


vim +/if +660 sound/core/pcm_native.c

607
608 /**
609 * snd_pcm_hw_params_choose - choose a configuration defined by @params
610 * @pcm: PCM instance
611 * @params: the hw_params instance
612 *
613 * Choose one configuration from configuration space defined by @params.
614 * The configuration chosen is that obtained fixing in this order:
615 * first access, first format, first subformat, min channels,
616 * min rate, min period time, max buffer size, min tick time
617 *
618 * Return: Zero if successful, or a negative error code on failure.
619 */
620 static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
621 struct snd_pcm_hw_params *params)
622 {
623 static const int vars[] = {
624 SNDRV_PCM_HW_PARAM_ACCESS,
625 SNDRV_PCM_HW_PARAM_FORMAT,
626 SNDRV_PCM_HW_PARAM_SUBFORMAT,
627 SNDRV_PCM_HW_PARAM_CHANNELS,
628 SNDRV_PCM_HW_PARAM_RATE,
629 SNDRV_PCM_HW_PARAM_PERIOD_TIME,
630 SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
631 SNDRV_PCM_HW_PARAM_TICK_TIME,
632 -1
633 };
634 const int *v;
635 struct snd_mask old_mask __maybe_unused;
636 struct snd_interval old_interval __maybe_unused;
637 int changed;
638
639 for (v = vars; *v != -1; v++) {
640 /* Keep old parameter to trace. */
641 if (trace_hw_mask_param_enabled()) {
642 if (hw_is_mask(*v))
643 old_mask = *hw_param_mask(params, *v);
644 }
645 if (trace_hw_interval_param_enabled()) {
646 if (hw_is_interval(*v))
647 old_interval = *hw_param_interval(params, *v);
648 }
649 if (*v != SNDRV_PCM_HW_PARAM_BUFFER_SIZE)
650 changed = snd_pcm_hw_param_first(pcm, params, *v, NULL);
651 else
652 changed = snd_pcm_hw_param_last(pcm, params, *v, NULL);
653 if (changed < 0)
654 return changed;
655 if (changed == 0)
656 continue;
657
658 /* Trace the changed parameter. */
659 if (hw_is_mask(*v))
> 660 trace_hw_mask_param(pcm, *v, 0, &old_mask, hw_param_mask(params, *v));
661 if (hw_is_interval(*v)) {
662 trace_hw_interval_param(pcm, *v, 0, &old_interval,
663 hw_param_interval(params, *v));
664 }
665 }
666
667 return 0;
668 }
669

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests