[<prev] [next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2401271614550.3247@hadrien>
Date: Sat, 27 Jan 2024 16:15:26 +0100 (CET)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Walker Chen <walker.chen@...rfivetech.com>
cc: Mark Brown <broonie@...nel.org>,
Claudiu Beznea <claudiu.beznea@...rochip.com>,
linux-kernel@...r.kernel.org, oe-kbuild-all@...ts.linux.dev
Subject: sound/soc/starfive/jh7110_tdm.c:198:16-18: WARNING opportunity for
max() (fwd)
---------- Forwarded message ----------
Date: Sat, 27 Jan 2024 22:30:10 +0800
From: kernel test robot <lkp@...el.com>
To: oe-kbuild@...ts.linux.dev
Cc: lkp@...el.com, Julia Lawall <julia.lawall@...ia.fr>
Subject: sound/soc/starfive/jh7110_tdm.c:198:16-18: WARNING opportunity for
max()
BCC: lkp@...el.com
CC: oe-kbuild-all@...ts.linux.dev
CC: linux-kernel@...r.kernel.org
TO: Walker Chen <walker.chen@...rfivetech.com>
CC: Mark Brown <broonie@...nel.org>
CC: Claudiu Beznea <claudiu.beznea@...rochip.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3a5879d495b226d0404098e3564462d5f1daa33b
commit: fd4762b6b5cfa27bf44f5d624ce74b7dce4a479c ASoC: starfive: Add JH7110 TDM driver
date: 8 months ago
:::::: branch date: 15 hours ago
:::::: commit date: 8 months ago
config: openrisc-randconfig-r053-20240127 (https://download.01.org/0day-ci/archive/20240127/202401272205.TWGHvmpR-lkp@intel.com/config)
compiler: or1k-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@...el.com>
| Reported-by: Julia Lawall <julia.lawall@...ia.fr>
| Closes: https://lore.kernel.org/r/202401272205.TWGHvmpR-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> sound/soc/starfive/jh7110_tdm.c:198:16-18: WARNING opportunity for max()
sound/soc/starfive/jh7110_tdm.c:203:20-22: WARNING opportunity for max()
vim +198 sound/soc/starfive/jh7110_tdm.c
fd4762b6b5cfa2 Walker Chen 2023-05-26 193
fd4762b6b5cfa2 Walker Chen 2023-05-26 194 static int jh7110_tdm_syncdiv(struct jh7110_tdm_dev *tdm)
fd4762b6b5cfa2 Walker Chen 2023-05-26 195 {
fd4762b6b5cfa2 Walker Chen 2023-05-26 196 u32 sl, sscale, syncdiv;
fd4762b6b5cfa2 Walker Chen 2023-05-26 197
fd4762b6b5cfa2 Walker Chen 2023-05-26 @198 if (tdm->rx.sl >= tdm->tx.sl)
fd4762b6b5cfa2 Walker Chen 2023-05-26 199 sl = tdm->rx.sl;
fd4762b6b5cfa2 Walker Chen 2023-05-26 200 else
fd4762b6b5cfa2 Walker Chen 2023-05-26 201 sl = tdm->tx.sl;
fd4762b6b5cfa2 Walker Chen 2023-05-26 202
fd4762b6b5cfa2 Walker Chen 2023-05-26 203 if (tdm->rx.sscale >= tdm->tx.sscale)
fd4762b6b5cfa2 Walker Chen 2023-05-26 204 sscale = tdm->rx.sscale;
fd4762b6b5cfa2 Walker Chen 2023-05-26 205 else
fd4762b6b5cfa2 Walker Chen 2023-05-26 206 sscale = tdm->tx.sscale;
fd4762b6b5cfa2 Walker Chen 2023-05-26 207
fd4762b6b5cfa2 Walker Chen 2023-05-26 208 syncdiv = tdm->pcmclk / tdm->samplerate - 1;
fd4762b6b5cfa2 Walker Chen 2023-05-26 209
fd4762b6b5cfa2 Walker Chen 2023-05-26 210 if ((syncdiv + 1) < (sl * sscale)) {
fd4762b6b5cfa2 Walker Chen 2023-05-26 211 dev_err(tdm->dev, "Failed to set syncdiv!\n");
fd4762b6b5cfa2 Walker Chen 2023-05-26 212 return -EINVAL;
fd4762b6b5cfa2 Walker Chen 2023-05-26 213 }
fd4762b6b5cfa2 Walker Chen 2023-05-26 214
fd4762b6b5cfa2 Walker Chen 2023-05-26 215 if (tdm->syncm == TDM_SYNCM_LONG &&
fd4762b6b5cfa2 Walker Chen 2023-05-26 216 (tdm->rx.sscale <= 1 || tdm->tx.sscale <= 1) &&
fd4762b6b5cfa2 Walker Chen 2023-05-26 217 ((syncdiv + 1) <= sl)) {
fd4762b6b5cfa2 Walker Chen 2023-05-26 218 dev_err(tdm->dev, "Wrong syncdiv! It must be (syncdiv+1) > max[tx.sl, rx.sl]\n");
fd4762b6b5cfa2 Walker Chen 2023-05-26 219 return -EINVAL;
fd4762b6b5cfa2 Walker Chen 2023-05-26 220 }
fd4762b6b5cfa2 Walker Chen 2023-05-26 221
fd4762b6b5cfa2 Walker Chen 2023-05-26 222 jh7110_tdm_writel(tdm, TDM_PCMDIV, syncdiv);
fd4762b6b5cfa2 Walker Chen 2023-05-26 223 return 0;
fd4762b6b5cfa2 Walker Chen 2023-05-26 224 }
fd4762b6b5cfa2 Walker Chen 2023-05-26 225
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists