aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2010-02-17 05:18:53 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-02-17 18:46:24 -0500
commit22ed130719987d1081831dc1481160b216224ffd (patch)
treedf4d50cb0222d80755cb44ed398bc6afbcc06ca8 /drivers/s390/scsi
parent67feeebaa7038129ad58ae0dcece8142186b36a9 (diff)
[SCSI] zfcp: Fix warnings from smatch
The smatch tool from http://repo.or.cz/w/smatch.git warns about this: drivers/s390/scsi/zfcp_scsi.c +64 zfcp_scsi_command_fail(5) warn: variable dereferenced before check 'scpnt->device' drivers/s390/scsi/zfcp_scsi.c +64 zfcp_scsi_command_fail(5) warn: variable dereferenced before check 'scpnt->device->host' drivers/s390/scsi/zfcp_scsi.c +93 zfcp_scsi_queuecommand(23) warn: variable dereferenced before check 'unit' Fix the first two warnings by removing the checks for scpnt->device and -> host: As long as the SCSI command exists, there is also a scsi_device and a Scsi_Host. Fix the last warning by removing the BUG_ON checks in zfcp_scsi_queuecommand, they are leftovers from previous paranoia about wrong pointers between data structures. Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi')
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index e1e56f523116..1fce8a49fc60 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -60,10 +60,9 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
60{ 60{
61 struct zfcp_adapter *adapter = 61 struct zfcp_adapter *adapter =
62 (struct zfcp_adapter *) scpnt->device->host->hostdata[0]; 62 (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
63
63 set_host_byte(scpnt, result); 64 set_host_byte(scpnt, result);
64 if ((scpnt->device != NULL) && (scpnt->device->host != NULL)) 65 zfcp_dbf_scsi_result("fail", 4, adapter->dbf, scpnt, NULL);
65 zfcp_dbf_scsi_result("fail", 4, adapter->dbf, scpnt, NULL);
66 /* return directly */
67 scpnt->scsi_done(scpnt); 66 scpnt->scsi_done(scpnt);
68} 67}
69 68
@@ -87,14 +86,6 @@ static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt,
87 adapter = (struct zfcp_adapter *) scpnt->device->host->hostdata[0]; 86 adapter = (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
88 unit = scpnt->device->hostdata; 87 unit = scpnt->device->hostdata;
89 88
90 BUG_ON(!adapter || (adapter != unit->port->adapter));
91 BUG_ON(!scpnt->scsi_done);
92
93 if (unlikely(!unit)) {
94 zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
95 return 0;
96 }
97
98 scsi_result = fc_remote_port_chkready(rport); 89 scsi_result = fc_remote_port_chkready(rport);
99 if (unlikely(scsi_result)) { 90 if (unlikely(scsi_result)) {
100 scpnt->result = scsi_result; 91 scpnt->result = scsi_result;