diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-10-25 21:53:33 +0800 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2013-11-28 14:02:05 +0000 |
commit | 5874fd1d23ed9a7a49802c2cfeed8d57b9ae303d (patch) | |
tree | 0176d89df5b2acd9748b78372af710aea8c0e479 /drivers/target | |
parent | 069b7dec73731bb979c5fcc773934d2f403f69a0 (diff) |
target/pscsi: fix return value check
commit 58932e96e438cd78f75e765d7b87ef39d3533d15 upstream.
In case of error, the function scsi_host_lookup() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
[bwh: Backported to 3.2: pscsi_configure_device() returns a pointer]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_pscsi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 5c12137c526..e813227a00e 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -129,10 +129,10 @@ static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag) * pSCSI Host ID and enable for phba mode */ sh = scsi_host_lookup(phv->phv_host_id); - if (IS_ERR(sh)) { + if (!sh) { pr_err("pSCSI: Unable to locate SCSI Host for" " phv_host_id: %d\n", phv->phv_host_id); - return PTR_ERR(sh); + return -EINVAL; } phv->phv_lld_host = sh; @@ -564,10 +564,10 @@ static struct se_device *pscsi_create_virtdevice( sh = phv->phv_lld_host; } else { sh = scsi_host_lookup(pdv->pdv_host_id); - if (IS_ERR(sh)) { + if (!sh) { pr_err("pSCSI: Unable to locate" " pdv_host_id: %d\n", pdv->pdv_host_id); - return ERR_CAST(sh); + return ERR_PTR(-EINVAL); } } } else { |