drivers/scsi/mpi3mr/mpi3mr_fw.c:1209 mpi3mr_issue_reset() error: uninitialized symbol 'host_diagnostic'.

From: Dan Carpenter
Date: Thu Feb 17 2022 - 08:04:15 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d567f5db412ed52de0b3b3efca4a451263de6108
commit: b64845a7d4039ab9667bafff9d7bb59365f17c0f scsi: mpi3mr: Detect async reset that occurred in firmware
config: s390-randconfig-m031-20220214 (https://download.01.org/0day-ci/archive/20220215/202202150735.ENek3KKS-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 11.2.0

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

New smatch warnings:
drivers/scsi/mpi3mr/mpi3mr_fw.c:1209 mpi3mr_issue_reset() error: uninitialized symbol 'host_diagnostic'.

vim +/host_diagnostic +1209 drivers/scsi/mpi3mr/mpi3mr_fw.c

824a156633dfdb Kashyap Desai 2021-05-20 1181 static int mpi3mr_issue_reset(struct mpi3mr_ioc *mrioc, u16 reset_type,
824a156633dfdb Kashyap Desai 2021-05-20 1182 u32 reset_reason)
824a156633dfdb Kashyap Desai 2021-05-20 1183 {
f061178e076210 Kashyap Desai 2021-05-20 1184 int retval = -1;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1185 u8 unlock_retry_count = 0;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1186 u32 host_diagnostic, ioc_status, ioc_config;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1187 u32 timeout = MPI3MR_RESET_ACK_TIMEOUT * 10;
f061178e076210 Kashyap Desai 2021-05-20 1188
f061178e076210 Kashyap Desai 2021-05-20 1189 if ((reset_type != MPI3_SYSIF_HOST_DIAG_RESET_ACTION_SOFT_RESET) &&
f061178e076210 Kashyap Desai 2021-05-20 1190 (reset_type != MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT))
b64845a7d4039a Sreekanth Reddy 2021-12-20 1191 return retval;
f061178e076210 Kashyap Desai 2021-05-20 1192 if (mrioc->unrecoverable)
b64845a7d4039a Sreekanth Reddy 2021-12-20 1193 return retval;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1194 if (reset_reason == MPI3MR_RESET_FROM_FIRMWARE) {
b64845a7d4039a Sreekanth Reddy 2021-12-20 1195 retval = 0;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1196 return retval;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1197 }
b64845a7d4039a Sreekanth Reddy 2021-12-20 1198
b64845a7d4039a Sreekanth Reddy 2021-12-20 1199 ioc_info(mrioc, "%s reset due to %s(0x%x)\n",
b64845a7d4039a Sreekanth Reddy 2021-12-20 1200 mpi3mr_reset_type_name(reset_type),
b64845a7d4039a Sreekanth Reddy 2021-12-20 1201 mpi3mr_reset_rc_name(reset_reason), reset_reason);
b64845a7d4039a Sreekanth Reddy 2021-12-20 1202
f061178e076210 Kashyap Desai 2021-05-20 1203 mpi3mr_clear_reset_history(mrioc);
f061178e076210 Kashyap Desai 2021-05-20 1204 do {
f061178e076210 Kashyap Desai 2021-05-20 1205 ioc_info(mrioc,
f061178e076210 Kashyap Desai 2021-05-20 1206 "Write magic sequence to unlock host diag register (retry=%d)\n",
f061178e076210 Kashyap Desai 2021-05-20 1207 ++unlock_retry_count);
f061178e076210 Kashyap Desai 2021-05-20 1208 if (unlock_retry_count >= MPI3MR_HOSTDIAG_UNLOCK_RETRY_COUNT) {
b64845a7d4039a Sreekanth Reddy 2021-12-20 @1209 ioc_err(mrioc,
b64845a7d4039a Sreekanth Reddy 2021-12-20 1210 "%s reset failed due to unlock failure, host_diagnostic(0x%08x)\n",
b64845a7d4039a Sreekanth Reddy 2021-12-20 1211 mpi3mr_reset_type_name(reset_type),
b64845a7d4039a Sreekanth Reddy 2021-12-20 1212 host_diagnostic);

Not intialized yet.

f061178e076210 Kashyap Desai 2021-05-20 1213 mrioc->unrecoverable = 1;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1214 return retval;
f061178e076210 Kashyap Desai 2021-05-20 1215 }
f061178e076210 Kashyap Desai 2021-05-20 1216
f061178e076210 Kashyap Desai 2021-05-20 1217 writel(MPI3_SYSIF_WRITE_SEQUENCE_KEY_VALUE_FLUSH,
f061178e076210 Kashyap Desai 2021-05-20 1218 &mrioc->sysif_regs->write_sequence);
f061178e076210 Kashyap Desai 2021-05-20 1219 writel(MPI3_SYSIF_WRITE_SEQUENCE_KEY_VALUE_1ST,
f061178e076210 Kashyap Desai 2021-05-20 1220 &mrioc->sysif_regs->write_sequence);
f061178e076210 Kashyap Desai 2021-05-20 1221 writel(MPI3_SYSIF_WRITE_SEQUENCE_KEY_VALUE_2ND,
f061178e076210 Kashyap Desai 2021-05-20 1222 &mrioc->sysif_regs->write_sequence);
f061178e076210 Kashyap Desai 2021-05-20 1223 writel(MPI3_SYSIF_WRITE_SEQUENCE_KEY_VALUE_3RD,
f061178e076210 Kashyap Desai 2021-05-20 1224 &mrioc->sysif_regs->write_sequence);
f061178e076210 Kashyap Desai 2021-05-20 1225 writel(MPI3_SYSIF_WRITE_SEQUENCE_KEY_VALUE_4TH,
f061178e076210 Kashyap Desai 2021-05-20 1226 &mrioc->sysif_regs->write_sequence);
f061178e076210 Kashyap Desai 2021-05-20 1227 writel(MPI3_SYSIF_WRITE_SEQUENCE_KEY_VALUE_5TH,
f061178e076210 Kashyap Desai 2021-05-20 1228 &mrioc->sysif_regs->write_sequence);
f061178e076210 Kashyap Desai 2021-05-20 1229 writel(MPI3_SYSIF_WRITE_SEQUENCE_KEY_VALUE_6TH,
f061178e076210 Kashyap Desai 2021-05-20 1230 &mrioc->sysif_regs->write_sequence);
f061178e076210 Kashyap Desai 2021-05-20 1231 usleep_range(1000, 1100);
f061178e076210 Kashyap Desai 2021-05-20 1232 host_diagnostic = readl(&mrioc->sysif_regs->host_diagnostic);
f061178e076210 Kashyap Desai 2021-05-20 1233 ioc_info(mrioc,
f061178e076210 Kashyap Desai 2021-05-20 1234 "wrote magic sequence: retry_count(%d), host_diagnostic(0x%08x)\n",
f061178e076210 Kashyap Desai 2021-05-20 1235 unlock_retry_count, host_diagnostic);
f061178e076210 Kashyap Desai 2021-05-20 1236 } while (!(host_diagnostic & MPI3_SYSIF_HOST_DIAG_DIAG_WRITE_ENABLE));
f061178e076210 Kashyap Desai 2021-05-20 1237
f061178e076210 Kashyap Desai 2021-05-20 1238 writel(reset_reason, &mrioc->sysif_regs->scratchpad[0]);
f061178e076210 Kashyap Desai 2021-05-20 1239 writel(host_diagnostic | reset_type,
f061178e076210 Kashyap Desai 2021-05-20 1240 &mrioc->sysif_regs->host_diagnostic);
b64845a7d4039a Sreekanth Reddy 2021-12-20 1241 switch (reset_type) {
b64845a7d4039a Sreekanth Reddy 2021-12-20 1242 case MPI3_SYSIF_HOST_DIAG_RESET_ACTION_SOFT_RESET:
f061178e076210 Kashyap Desai 2021-05-20 1243 do {
f061178e076210 Kashyap Desai 2021-05-20 1244 ioc_status = readl(&mrioc->sysif_regs->ioc_status);
f061178e076210 Kashyap Desai 2021-05-20 1245 ioc_config =
f061178e076210 Kashyap Desai 2021-05-20 1246 readl(&mrioc->sysif_regs->ioc_configuration);
b64845a7d4039a Sreekanth Reddy 2021-12-20 1247 if ((ioc_status & MPI3_SYSIF_IOC_STATUS_RESET_HISTORY)
b64845a7d4039a Sreekanth Reddy 2021-12-20 1248 && mpi3mr_soft_reset_success(ioc_status, ioc_config)
b64845a7d4039a Sreekanth Reddy 2021-12-20 1249 ) {
b64845a7d4039a Sreekanth Reddy 2021-12-20 1250 mpi3mr_clear_reset_history(mrioc);
f061178e076210 Kashyap Desai 2021-05-20 1251 retval = 0;
f061178e076210 Kashyap Desai 2021-05-20 1252 break;
f061178e076210 Kashyap Desai 2021-05-20 1253 }
f061178e076210 Kashyap Desai 2021-05-20 1254 msleep(100);
f061178e076210 Kashyap Desai 2021-05-20 1255 } while (--timeout);
b64845a7d4039a Sreekanth Reddy 2021-12-20 1256 mpi3mr_print_fault_info(mrioc);
b64845a7d4039a Sreekanth Reddy 2021-12-20 1257 break;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1258 case MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT:
f061178e076210 Kashyap Desai 2021-05-20 1259 do {
f061178e076210 Kashyap Desai 2021-05-20 1260 ioc_status = readl(&mrioc->sysif_regs->ioc_status);
f061178e076210 Kashyap Desai 2021-05-20 1261 if (mpi3mr_diagfault_success(mrioc, ioc_status)) {
f061178e076210 Kashyap Desai 2021-05-20 1262 retval = 0;
f061178e076210 Kashyap Desai 2021-05-20 1263 break;
f061178e076210 Kashyap Desai 2021-05-20 1264 }
f061178e076210 Kashyap Desai 2021-05-20 1265 msleep(100);
f061178e076210 Kashyap Desai 2021-05-20 1266 } while (--timeout);
b64845a7d4039a Sreekanth Reddy 2021-12-20 1267 break;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1268 default:
b64845a7d4039a Sreekanth Reddy 2021-12-20 1269 break;
b64845a7d4039a Sreekanth Reddy 2021-12-20 1270 }
b64845a7d4039a Sreekanth Reddy 2021-12-20 1271
f061178e076210 Kashyap Desai 2021-05-20 1272 writel(MPI3_SYSIF_WRITE_SEQUENCE_KEY_VALUE_2ND,
f061178e076210 Kashyap Desai 2021-05-20 1273 &mrioc->sysif_regs->write_sequence);
f061178e076210 Kashyap Desai 2021-05-20 1274
f061178e076210 Kashyap Desai 2021-05-20 1275 ioc_config = readl(&mrioc->sysif_regs->ioc_configuration);
b64845a7d4039a Sreekanth Reddy 2021-12-20 1276 ioc_status = readl(&mrioc->sysif_regs->ioc_status);
f061178e076210 Kashyap Desai 2021-05-20 1277 ioc_info(mrioc,
b64845a7d4039a Sreekanth Reddy 2021-12-20 1278 "ioc_status/ioc_onfig after %s reset is (0x%x)/(0x%x)\n",
f061178e076210 Kashyap Desai 2021-05-20 1279 (!retval)?"successful":"failed", ioc_status,
f061178e076210 Kashyap Desai 2021-05-20 1280 ioc_config);
b64845a7d4039a Sreekanth Reddy 2021-12-20 1281 if (retval)
b64845a7d4039a Sreekanth Reddy 2021-12-20 1282 mrioc->unrecoverable = 1;
f061178e076210 Kashyap Desai 2021-05-20 1283 return retval;
824a156633dfdb Kashyap Desai 2021-05-20 1284 }

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