Commit 58932e96 authored by Wei Yongjun's avatar Wei Yongjun Committed by Nicholas Bellinger

target/pscsi: fix return value check

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 48502ddb
...@@ -134,10 +134,10 @@ static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag) ...@@ -134,10 +134,10 @@ static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag)
* pSCSI Host ID and enable for phba mode * pSCSI Host ID and enable for phba mode
*/ */
sh = scsi_host_lookup(phv->phv_host_id); sh = scsi_host_lookup(phv->phv_host_id);
if (IS_ERR(sh)) { if (!sh) {
pr_err("pSCSI: Unable to locate SCSI Host for" pr_err("pSCSI: Unable to locate SCSI Host for"
" phv_host_id: %d\n", phv->phv_host_id); " phv_host_id: %d\n", phv->phv_host_id);
return PTR_ERR(sh); return -EINVAL;
} }
phv->phv_lld_host = sh; phv->phv_lld_host = sh;
...@@ -515,10 +515,10 @@ static int pscsi_configure_device(struct se_device *dev) ...@@ -515,10 +515,10 @@ static int pscsi_configure_device(struct se_device *dev)
sh = phv->phv_lld_host; sh = phv->phv_lld_host;
} else { } else {
sh = scsi_host_lookup(pdv->pdv_host_id); sh = scsi_host_lookup(pdv->pdv_host_id);
if (IS_ERR(sh)) { if (!sh) {
pr_err("pSCSI: Unable to locate" pr_err("pSCSI: Unable to locate"
" pdv_host_id: %d\n", pdv->pdv_host_id); " pdv_host_id: %d\n", pdv->pdv_host_id);
return PTR_ERR(sh); return -EINVAL;
} }
} }
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment