Skip to contentSkip to conversation

sound/soc/codecs/tlv320aic32x4-clk.c:219 clk_aic32x4_pll_determine_rate() warn: unsigned 'rate' is never less than zero.

PATCH kernel test robot 2 participants 2 messages Jun 10, 2023 – Jun 13, 2023

Subsystems (4)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-determine-rate
head:   326cc42f9fdc3030676e949d5cea3ccc923fd1de
commit: 25d43ec352eaefbfaee0912d02b6f10ea606931f [66/68] ASoC: tlv320aic32x4: pll: Switch to determine_rate
config: x86_64-randconfig-m001-20230608 (https://download.01.org/0day-ci/archive/20230610/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

smatch warnings:
sound/soc/codecs/tlv320aic32x4-clk.c:219 clk_aic32x4_pll_determine_rate() warn: unsigned 'rate' is never less than zero.

vim +/rate +219 sound/soc/codecs/tlv320aic32x4-clk.c

206
207 static int clk_aic32x4_pll_determine_rate(struct clk_hw *hw,
208 struct clk_rate_request *req)
209 {
210 struct clk_aic32x4_pll_muldiv settings;
211 unsigned long rate;
212 int ret;
213
214 ret = clk_aic32x4_pll_calc_muldiv(&settings, req->rate, req->best_parent_rate);
215 if (ret < 0)
216 return -EINVAL;
217
218 rate = clk_aic32x4_pll_calc_rate(&settings, req->best_parent_rate);

 > 219		if (rate < 0)

220 return rate;
221
222 req->rate = rate;
223 return 0;
224 }
225

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#1 lore raw

Quoting kernel test robot (2023-06-09 21:38:56)

Quoted 29 lines
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-determine-rate
head:   326cc42f9fdc3030676e949d5cea3ccc923fd1de
commit: 25d43ec352eaefbfaee0912d02b6f10ea606931f [66/68] ASoC: tlv320aic32x4: pll: Switch to determine_rate
config: x86_64-randconfig-m001-20230608 (https://download.01.org/0day-ci/archive/20230610/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

smatch warnings:
sound/soc/codecs/tlv320aic32x4-clk.c:219 clk_aic32x4_pll_determine_rate() warn: unsigned 'rate' is never less than zero.

vim +/rate +219 sound/soc/codecs/tlv320aic32x4-clk.c

   206  
   207  static int clk_aic32x4_pll_determine_rate(struct clk_hw *hw,
   208                                            struct clk_rate_request *req)
   209  {
   210          struct clk_aic32x4_pll_muldiv settings;
   211          unsigned long rate;
   212          int ret;
   213  
   214          ret = clk_aic32x4_pll_calc_muldiv(&settings, req->rate, req->best_parent_rate);
   215          if (ret < 0)
   216                  return -EINVAL;
   217  
   218          rate = clk_aic32x4_pll_calc_rate(&settings, req->best_parent_rate);
Quoted 7 lines
Quoted 1 line

219 if (rate < 0)

   220                  return rate;
   221  
   222          req->rate = rate;
   223          return 0;
   224  }
   225  

Should we just apply this patch?

---8<---

sound/soc/codecs/tlv320aic32x4-clk.c +1 -5
index a7ec501b4c69..c116e82f712d 100644
@@ -208,18 +208,14 @@ static int clk_aic32x4_pll_determine_rate(struct clk_hw *hw,
 					  struct clk_rate_request *req)
 {
 	struct clk_aic32x4_pll_muldiv settings;
-	unsigned long rate;
 	int ret;
 
 	ret = clk_aic32x4_pll_calc_muldiv(&settings, req->rate, req->best_parent_rate);
 	if (ret < 0)
 		return -EINVAL;
 
-	rate = clk_aic32x4_pll_calc_rate(&settings, req->best_parent_rate);
-	if (rate < 0)
-		return rate;
+	req->rate = clk_aic32x4_pll_calc_rate(&settings, req->best_parent_rate);
 
-	req->rate = rate;
 	return 0;
 }