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

Stephen Boyd sboyd at kernel.org
Mon Jun 12 18:06:26 PDT 2023


Quoting kernel test robot (2023-06-09 21:38:56)
> 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/202306101217.08CRVGcK-lkp@intel.com/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 <lkp at intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202306101217.08CRVGcK-lkp@intel.com/
> 
> 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  

Should we just apply this patch?

---8<---
diff --git a/sound/soc/codecs/tlv320aic32x4-clk.c b/sound/soc/codecs/tlv320aic32x4-clk.c
index a7ec501b4c69..c116e82f712d 100644
--- a/sound/soc/codecs/tlv320aic32x4-clk.c
+++ b/sound/soc/codecs/tlv320aic32x4-clk.c
@@ -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;
 }



More information about the linux-arm-kernel mailing list