scsi: message: fusion: Open-code mptfc_block_error_handler() for bus reset
Hello Hannes Reinecke,
The patch 17865dc2eccc: "scsi: message: fusion: Open-code mptfc_block_error_handler() for bus reset" from Oct 2, 2023 (linux-next), leads to the following Smatch static checker warning:
drivers/message/fusion/mptfc.c:281 mptfc_bus_reset()
error: uninitialized symbol 'rtn'.
drivers/message/fusion/mptfc.c
261 static int
262 mptfc_bus_reset(struct scsi_cmnd *SCpnt)
263 {
264 struct Scsi_Host *shost = SCpnt->device->host;
265 MPT_SCSI_HOST __maybe_unused *hd = shost_priv(shost);
266 int channel = SCpnt->device->channel;
267 struct mptfc_rport_info *ri;
268 int rtn;
269
270 list_for_each_entry(ri, &hd->ioc->fc_rports, list) {
271 if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) {
272 VirtTarget *vtarget = ri->starget->hostdata;
273
274 if (!vtarget || vtarget->channel != channel)
275 continue;
276 rtn = fc_block_rport(ri->rport);Are we always going to hit this assignment?
277 if (rtn != 0)
278 break;
279 }
280 }
--> 281 if (rtn == 0) {
282 dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
283 "%s.%d: %d:%llu, executing recovery.\n", __func__,
284 hd->ioc->name, shost->host_no,
285 SCpnt->device->id, SCpnt->device->lun));
286 rtn = mptscsih_bus_reset(SCpnt);
287 }
288 return rtn;
289 }
290
291 static voidregards,
dan carpenter
Quoted 27 lines · Dan Carpenter
Hello Hannes Reinecke,
The patch
17865dc2eccc: "scsi: message: fusion: Open-codemptfc_block_error_handler()for bus reset" from Oct 2, 2023 (linux-next), leads to the following Smatch static checker warning:
drivers/message/fusion/mptfc.c:281mptfc_bus_reset()
error: uninitialized symbol 'rtn'.
drivers/message/fusion/mptfc.c261 static int 262 mptfc_bus_reset(struct scsi_cmnd *SCpnt) 263 { 264 struct Scsi_Host *shost = SCpnt->device->host; 265 MPT_SCSI_HOST __maybe_unused *hd = shost_priv(shost); 266 int channel = SCpnt->device->channel; 267 struct mptfc_rport_info *ri; 268 int rtn; 269 270 list_for_each_entry(ri, &hd->ioc->fc_rports, list) { 271 if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) { 272 VirtTarget *vtarget = ri->starget->hostdata; 273 274 if (!vtarget || vtarget->channel != channel) 275 continue; 276 rtn = fc_block_rport(ri->rport);
Quoted 2 lines
Are we always going to hit this assignment?
I _think_, but it'll be good to initialize anyway. Thanks for the report.
Cheers,
Hannes