From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: sound/soc/codecs/tas2781-i2c.c:255:26-27: WARNING opportunity for min()
Date: Tue, 2 Jan 2024 19:53:21 +0800 [thread overview]
Message-ID: <202401021929.eW58tuKw-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Shenghao Ding <13916275206@139.com>
CC: Mark Brown <broonie@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 610a9b8f49fbcf1100716370d3b5f6f884a2835a
commit: ef3bcde75d06d65f78ba38a30d5a87fb83a5cdae ASoC: tas2781: Add tas2781 driver
date: 7 months ago
:::::: branch date: 2 days ago
:::::: commit date: 7 months ago
config: sparc64-randconfig-r051-20240102 (https://download.01.org/0day-ci/archive/20240102/202401021929.eW58tuKw-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202401021929.eW58tuKw-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> sound/soc/codecs/tas2781-i2c.c:255:26-27: WARNING opportunity for min()
sound/soc/codecs/tas2781-i2c.c:365:14-15: WARNING opportunity for min()
vim +255 sound/soc/codecs/tas2781-i2c.c
ef3bcde75d06d6 Shenghao Ding 2023-06-18 223
ef3bcde75d06d6 Shenghao Ding 2023-06-18 224 static int tasdevice_create_control(struct tasdevice_priv *tas_priv)
ef3bcde75d06d6 Shenghao Ding 2023-06-18 225 {
ef3bcde75d06d6 Shenghao Ding 2023-06-18 226 struct snd_kcontrol_new *prof_ctrls;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 227 int nr_controls = 1;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 228 int mix_index = 0;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 229 int ret;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 230 char *name;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 231
ef3bcde75d06d6 Shenghao Ding 2023-06-18 232 prof_ctrls = devm_kcalloc(tas_priv->dev, nr_controls,
ef3bcde75d06d6 Shenghao Ding 2023-06-18 233 sizeof(prof_ctrls[0]), GFP_KERNEL);
ef3bcde75d06d6 Shenghao Ding 2023-06-18 234 if (!prof_ctrls) {
ef3bcde75d06d6 Shenghao Ding 2023-06-18 235 ret = -ENOMEM;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 236 goto out;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 237 }
ef3bcde75d06d6 Shenghao Ding 2023-06-18 238
ef3bcde75d06d6 Shenghao Ding 2023-06-18 239 /* Create a mixer item for selecting the active profile */
ef3bcde75d06d6 Shenghao Ding 2023-06-18 240 name = devm_kzalloc(tas_priv->dev, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
ef3bcde75d06d6 Shenghao Ding 2023-06-18 241 GFP_KERNEL);
ef3bcde75d06d6 Shenghao Ding 2023-06-18 242 if (!name) {
ef3bcde75d06d6 Shenghao Ding 2023-06-18 243 ret = -ENOMEM;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 244 goto out;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 245 }
ef3bcde75d06d6 Shenghao Ding 2023-06-18 246 scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "Speaker Profile Id");
ef3bcde75d06d6 Shenghao Ding 2023-06-18 247 prof_ctrls[mix_index].name = name;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 248 prof_ctrls[mix_index].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 249 prof_ctrls[mix_index].info = tasdevice_info_profile;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 250 prof_ctrls[mix_index].get = tasdevice_get_profile_id;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 251 prof_ctrls[mix_index].put = tasdevice_set_profile_id;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 252 mix_index++;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 253
ef3bcde75d06d6 Shenghao Ding 2023-06-18 254 ret = snd_soc_add_component_controls(tas_priv->codec,
ef3bcde75d06d6 Shenghao Ding 2023-06-18 @255 prof_ctrls, nr_controls < mix_index ? nr_controls : mix_index);
ef3bcde75d06d6 Shenghao Ding 2023-06-18 256
ef3bcde75d06d6 Shenghao Ding 2023-06-18 257 out:
ef3bcde75d06d6 Shenghao Ding 2023-06-18 258 return ret;
ef3bcde75d06d6 Shenghao Ding 2023-06-18 259 }
ef3bcde75d06d6 Shenghao Ding 2023-06-18 260
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2024-01-02 11:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-02 11:53 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-07-16 16:41 sound/soc/codecs/tas2781-i2c.c:255:26-27: WARNING opportunity for min() kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202401021929.eW58tuKw-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.