diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-10-25 09:53:33 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-10-25 13:42:09 -0400 |
commit | 58932e96e438cd78f75e765d7b87ef39d3533d15 (patch) | |
tree | a431bf2d95dcc04f3a09c1f3dfe956ceaf1527ee | |
parent | 48502ddbfb9840803f633ff81eee507e0fdae7c5 (diff) |
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-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 551c96ca60ac..0f199f6a0738 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -134,10 +134,10 @@ static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag) | |||
134 | * pSCSI Host ID and enable for phba mode | 134 | * pSCSI Host ID and enable for phba mode |
135 | */ | 135 | */ |
136 | sh = scsi_host_lookup(phv->phv_host_id); | 136 | sh = scsi_host_lookup(phv->phv_host_id); |
137 | if (IS_ERR(sh)) { | 137 | if (!sh) { |
138 | pr_err("pSCSI: Unable to locate SCSI Host for" | 138 | pr_err("pSCSI: Unable to locate SCSI Host for" |
139 | " phv_host_id: %d\n", phv->phv_host_id); | 139 | " phv_host_id: %d\n", phv->phv_host_id); |
140 | return PTR_ERR(sh); | 140 | return -EINVAL; |
141 | } | 141 | } |
142 | 142 | ||
143 | phv->phv_lld_host = sh; | 143 | phv->phv_lld_host = sh; |
@@ -515,10 +515,10 @@ static int pscsi_configure_device(struct se_device *dev) | |||
515 | sh = phv->phv_lld_host; | 515 | sh = phv->phv_lld_host; |
516 | } else { | 516 | } else { |
517 | sh = scsi_host_lookup(pdv->pdv_host_id); | 517 | sh = scsi_host_lookup(pdv->pdv_host_id); |
518 | if (IS_ERR(sh)) { | 518 | if (!sh) { |
519 | pr_err("pSCSI: Unable to locate" | 519 | pr_err("pSCSI: Unable to locate" |
520 | " pdv_host_id: %d\n", pdv->pdv_host_id); | 520 | " pdv_host_id: %d\n", pdv->pdv_host_id); |
521 | return PTR_ERR(sh); | 521 | return -EINVAL; |
522 | } | 522 | } |
523 | } | 523 | } |
524 | } else { | 524 | } else { |