drivers/clk/bcm/clk-bcm2835.c:942:6: error: variable 'rem' set but not used

From: kernel test robot
Date: Sun Feb 13 2022 - 07:13:23 EST


Hi Maxime,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b81b1829e7e39f6cebdf6e4d5484eacbceda8554
commit: 8ca011ef4af48a7af7b15afd8a4a44039dd04cea clk: bcm-2835: Remove rounding up the dividers
date: 4 months ago
config: arm-randconfig-r006-20220213 (https://download.01.org/0day-ci/archive/20220213/202202132034.ZltYqjTa-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 478c237e21b2c3a83e46f26fcbeb3876682f9b14)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8ca011ef4af48a7af7b15afd8a4a44039dd04cea
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8ca011ef4af48a7af7b15afd8a4a44039dd04cea
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/clk/bcm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> drivers/clk/bcm/clk-bcm2835.c:942:6: error: variable 'rem' set but not used [-Werror,-Wunused-but-set-variable]
u64 rem;
^
1 error generated.


vim +/rem +942 drivers/clk/bcm/clk-bcm2835.c

41691b8862e2a3 Eric Anholt 2015-10-08 932
41691b8862e2a3 Eric Anholt 2015-10-08 933 static u32 bcm2835_clock_choose_div(struct clk_hw *hw,
41691b8862e2a3 Eric Anholt 2015-10-08 934 unsigned long rate,
8ca011ef4af48a Maxime Ripard 2021-09-22 935 unsigned long parent_rate)
41691b8862e2a3 Eric Anholt 2015-10-08 936 {
41691b8862e2a3 Eric Anholt 2015-10-08 937 struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
41691b8862e2a3 Eric Anholt 2015-10-08 938 const struct bcm2835_clock_data *data = clock->data;
9c95b32ca09364 Remi Pommarel 2015-12-06 939 u32 unused_frac_mask =
9c95b32ca09364 Remi Pommarel 2015-12-06 940 GENMASK(CM_DIV_FRAC_BITS - data->frac_bits, 0) >> 1;
41691b8862e2a3 Eric Anholt 2015-10-08 941 u64 temp = (u64)parent_rate << CM_DIV_FRAC_BITS;
9c95b32ca09364 Remi Pommarel 2015-12-06 @942 u64 rem;
959ca92a3235fc Martin Sperl 2016-02-29 943 u32 div, mindiv, maxdiv;
41691b8862e2a3 Eric Anholt 2015-10-08 944
9c95b32ca09364 Remi Pommarel 2015-12-06 945 rem = do_div(temp, rate);
41691b8862e2a3 Eric Anholt 2015-10-08 946 div = temp;
41691b8862e2a3 Eric Anholt 2015-10-08 947 div &= ~unused_frac_mask;
41691b8862e2a3 Eric Anholt 2015-10-08 948
959ca92a3235fc Martin Sperl 2016-02-29 949 /* different clamping limits apply for a mash clock */
959ca92a3235fc Martin Sperl 2016-02-29 950 if (data->is_mash_clock) {
959ca92a3235fc Martin Sperl 2016-02-29 951 /* clamp to min divider of 2 */
959ca92a3235fc Martin Sperl 2016-02-29 952 mindiv = 2 << CM_DIV_FRAC_BITS;
959ca92a3235fc Martin Sperl 2016-02-29 953 /* clamp to the highest possible integer divider */
959ca92a3235fc Martin Sperl 2016-02-29 954 maxdiv = (BIT(data->int_bits) - 1) << CM_DIV_FRAC_BITS;
959ca92a3235fc Martin Sperl 2016-02-29 955 } else {
997f16bd5d2e9b Martin Sperl 2016-02-29 956 /* clamp to min divider of 1 */
959ca92a3235fc Martin Sperl 2016-02-29 957 mindiv = 1 << CM_DIV_FRAC_BITS;
997f16bd5d2e9b Martin Sperl 2016-02-29 958 /* clamp to the highest possible fractional divider */
959ca92a3235fc Martin Sperl 2016-02-29 959 maxdiv = GENMASK(data->int_bits + CM_DIV_FRAC_BITS - 1,
959ca92a3235fc Martin Sperl 2016-02-29 960 CM_DIV_FRAC_BITS - data->frac_bits);
959ca92a3235fc Martin Sperl 2016-02-29 961 }
959ca92a3235fc Martin Sperl 2016-02-29 962
959ca92a3235fc Martin Sperl 2016-02-29 963 /* apply the clamping limits */
959ca92a3235fc Martin Sperl 2016-02-29 964 div = max_t(u32, div, mindiv);
959ca92a3235fc Martin Sperl 2016-02-29 965 div = min_t(u32, div, maxdiv);
41691b8862e2a3 Eric Anholt 2015-10-08 966
41691b8862e2a3 Eric Anholt 2015-10-08 967 return div;
41691b8862e2a3 Eric Anholt 2015-10-08 968 }
41691b8862e2a3 Eric Anholt 2015-10-08 969

:::::: The code at line 942 was first introduced by commit
:::::: 9c95b32ca09364e4687b72c4e17b78dc1c420026 clk: bcm2835: add a round up ability to the clock divisor

:::::: TO: Remi Pommarel <repk@xxxxxxxxxxxx>
:::::: CC: Michael Turquette <mturquette@xxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx