Re: [PATCH v4 2/3] drivers: clk: Add support for versa3 clock driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Biju,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Biju-Das/dt-bindings-clock-Add-Renesas-versa3-clock-generator-bindings/20230404-171012
base:   1bd575707d704530a52d5dd320c29d79e9cff42d
patch link:    https://lore.kernel.org/r/20230404090823.148226-3-biju.das.jz%40bp.renesas.com
patch subject: [PATCH v4 2/3] drivers: clk: Add support for versa3 clock driver
config: arc-randconfig-m031-20230405 (https://download.01.org/0day-ci/archive/20230408/202304081045.5aflIfGy-lkp@xxxxxxxxx/config)
compiler: arc-elf-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>
| Link: https://lore.kernel.org/r/202304081045.5aflIfGy-lkp@xxxxxxxxx/

smatch warnings:
drivers/clk/clk-versaclock3.c:546 vc3_clk_mux_determine_rate() warn: replace divide condition 'req->best_parent_rate / req->rate' with 'req->best_parent_rate >= req->rate'

vim +546 drivers/clk/clk-versaclock3.c

fe68e1ca2f2871 Biju Das 2023-04-04  538  static int vc3_clk_mux_determine_rate(struct clk_hw *hw,
fe68e1ca2f2871 Biju Das 2023-04-04  539  				      struct clk_rate_request *req)
fe68e1ca2f2871 Biju Das 2023-04-04  540  {
fe68e1ca2f2871 Biju Das 2023-04-04  541  	int ret;
fe68e1ca2f2871 Biju Das 2023-04-04  542  	int frc;
fe68e1ca2f2871 Biju Das 2023-04-04  543  
fe68e1ca2f2871 Biju Das 2023-04-04  544  	ret = clk_mux_determine_rate_flags(hw, req, CLK_SET_RATE_PARENT);
fe68e1ca2f2871 Biju Das 2023-04-04  545  	if (ret) {
fe68e1ca2f2871 Biju Das 2023-04-04 @546  		if (req->best_parent_rate / req->rate) {
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What is this testing?  In terms of micro optimizing, divide operations
are normally slow.  And >= is more readable.  But maybe this is
something which makes sense with more context...

fe68e1ca2f2871 Biju Das 2023-04-04  547  			frc = DIV_ROUND_CLOSEST_ULL(req->best_parent_rate,
fe68e1ca2f2871 Biju Das 2023-04-04  548  						    req->rate);
fe68e1ca2f2871 Biju Das 2023-04-04  549  			req->rate *= frc;
fe68e1ca2f2871 Biju Das 2023-04-04  550  			return clk_mux_determine_rate_flags(hw, req,
fe68e1ca2f2871 Biju Das 2023-04-04  551  							    CLK_SET_RATE_PARENT);
fe68e1ca2f2871 Biju Das 2023-04-04  552  		}
fe68e1ca2f2871 Biju Das 2023-04-04  553  		ret = 0;
fe68e1ca2f2871 Biju Das 2023-04-04  554  	}
fe68e1ca2f2871 Biju Das 2023-04-04  555  
fe68e1ca2f2871 Biju Das 2023-04-04  556  	return ret;
fe68e1ca2f2871 Biju Das 2023-04-04  557  }

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




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux