summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/esas2r/esas2r_init.c
diff options
context:
space:
mode:
authorBradley Grove <bgrove@attotech.com>2013-08-29 15:55:40 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-09-06 11:13:25 -0700
commit64d29bd83ef36911001afc3d1f21404106739ce1 (patch)
tree270f0e98bb68b92e1b0b6278b843808c0779f3f5 /drivers/scsi/esas2r/esas2r_init.c
parentc88d2dddb0b84aaa1de2985627c081c9742667ae (diff)
[SCSI] esas2r: smatch - Fix dereference that occurs prior to check
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bradley Grove <bgrove@attotech.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/esas2r/esas2r_init.c')
-rw-r--r--drivers/scsi/esas2r/esas2r_init.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c
index 78b18c1eb43..9aaad0d1dcf 100644
--- a/drivers/scsi/esas2r/esas2r_init.c
+++ b/drivers/scsi/esas2r/esas2r_init.c
@@ -665,7 +665,7 @@ void esas2r_kill_adapter(int i)
int esas2r_cleanup(struct Scsi_Host *host)
{
- struct esas2r_adapter *a = (struct esas2r_adapter *)host->hostdata;
+ struct esas2r_adapter *a;
int index;
if (host == NULL) {
@@ -678,6 +678,7 @@ int esas2r_cleanup(struct Scsi_Host *host)
}
esas2r_debug("esas2r_cleanup called for host %p", host);
+ a = (struct esas2r_adapter *)host->hostdata;
index = a->index;
esas2r_kill_adapter(index);
return index;