[krzk-github:n/qcom-ufs-opp 16/18] drivers/scsi/ufs/ufshcd.c:1168:23: warning: variable 'pm_opp_target_rate' set but not used

From: kernel test robot
Date: Fri Apr 01 2022 - 13:38:35 EST


tree: https://github.com/krzk/linux n/qcom-ufs-opp
head: df7fc04027f28b5b133954ef8e766e3190a30d4f
commit: ab65d39794d1521614271985db9322211816dbb6 [16/18] WIP
config: mips-randconfig-r013-20220331 (https://download.01.org/0day-ci/archive/20220402/202204020157.isDVHFsp-lkp@xxxxxxxxx/config)
compiler: mipsel-linux-gcc (GCC) 11.2.0
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
# https://github.com/krzk/linux/commit/ab65d39794d1521614271985db9322211816dbb6
git remote add krzk-github https://github.com/krzk/linux
git fetch --no-tags krzk-github n/qcom-ufs-opp
git checkout ab65d39794d1521614271985db9322211816dbb6
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash arch/mips/mm/ drivers/scsi/ufs/

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

All warnings (new ones prefixed by >>):

drivers/scsi/ufs/ufshcd.c: In function 'ufshcd_scale_gear':
>> drivers/scsi/ufs/ufshcd.c:1168:23: warning: variable 'pm_opp_target_rate' set but not used [-Wunused-but-set-variable]
1168 | unsigned long pm_opp_target_rate;
| ^~~~~~~~~~~~~~~~~~


vim +/pm_opp_target_rate +1168 drivers/scsi/ufs/ufshcd.c

1154
1155 /**
1156 * ufshcd_scale_gear - scale up/down UFS gear
1157 * @hba: per adapter instance
1158 * @scale_up: True for scaling up gear and false for scaling down
1159 *
1160 * Returns 0 for success,
1161 * Returns -EBUSY if scaling can't happen at this time
1162 * Returns non-zero for any other errors
1163 */
1164 static int ufshcd_scale_gear(struct ufs_hba *hba, bool scale_up)
1165 {
1166 int ret = 0;
1167 struct ufs_clk_info *clki;
> 1168 unsigned long pm_opp_target_rate;
1169 struct ufs_pa_layer_attr new_pwr_info;
1170
1171 dev_err(hba->dev, "AAAA ufshcd_scale_gear %d - %d\n",
1172 scale_up, hba->use_pm_opp);
1173 clki = list_first_entry(&hba->clk_list_head, struct ufs_clk_info, list);
1174
1175 if (scale_up) {
1176 memcpy(&new_pwr_info, &hba->clk_scaling.saved_pwr_info.info,
1177 sizeof(struct ufs_pa_layer_attr));
1178 pm_opp_target_rate = clki->max_freq;
1179 } else {
1180 memcpy(&new_pwr_info, &hba->pwr_info,
1181 sizeof(struct ufs_pa_layer_attr));
1182
1183 if (hba->pwr_info.gear_tx > hba->clk_scaling.min_gear ||
1184 hba->pwr_info.gear_rx > hba->clk_scaling.min_gear) {
1185 /* save the current power mode */
1186 memcpy(&hba->clk_scaling.saved_pwr_info.info,
1187 &hba->pwr_info,
1188 sizeof(struct ufs_pa_layer_attr));
1189
1190 /* scale down gear */
1191 new_pwr_info.gear_tx = hba->clk_scaling.min_gear;
1192 new_pwr_info.gear_rx = hba->clk_scaling.min_gear;
1193 }
1194 pm_opp_target_rate = clki->min_freq;
1195 }
1196
1197 if (hba->use_pm_opp && scale_up) {
1198 //ret = dev_pm_opp_set_rate(hba->dev, pm_opp_target_rate);
1199 //dev_err(hba->dev, "AAA dev_pm_opp_set_rate %d\n", ret);
1200 //ret = 0;
1201 }
1202
1203 /* check if the power mode needs to be changed or not? */
1204 ret = ufshcd_config_pwr_mode(hba, &new_pwr_info);
1205 if (ret)
1206 dev_err(hba->dev, "%s: failed err %d, old gear: (tx %d rx %d), new gear: (tx %d rx %d)",
1207 __func__, ret,
1208 hba->pwr_info.gear_tx, hba->pwr_info.gear_rx,
1209 new_pwr_info.gear_tx, new_pwr_info.gear_rx);
1210
1211 if (hba->use_pm_opp && !scale_up) {
1212 //ret = dev_pm_opp_set_rate(hba->dev, pm_opp_target_rate);
1213 //dev_err(hba->dev, "AAA dev_pm_opp_set_rate %d\n", ret);
1214 //ret = 0;
1215 }
1216
1217 return ret;
1218 }
1219

--
0-DAY CI Kernel Test Service
https://01.org/lkp