Skip to content

Commit 58932e9

Browse files
Wei YongjunNicholas Bellinger
authored andcommitted
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>
1 parent 48502dd commit 58932e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/target/target_core_pscsi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag)
134134
* pSCSI Host ID and enable for phba mode
135135
*/
136136
sh = scsi_host_lookup(phv->phv_host_id);
137-
if (IS_ERR(sh)) {
137+
if (!sh) {
138138
pr_err("pSCSI: Unable to locate SCSI Host for"
139139
" phv_host_id: %d\n", phv->phv_host_id);
140-
return PTR_ERR(sh);
140+
return -EINVAL;
141141
}
142142

143143
phv->phv_lld_host = sh;
@@ -515,10 +515,10 @@ static int pscsi_configure_device(struct se_device *dev)
515515
sh = phv->phv_lld_host;
516516
} else {
517517
sh = scsi_host_lookup(pdv->pdv_host_id);
518-
if (IS_ERR(sh)) {
518+
if (!sh) {
519519
pr_err("pSCSI: Unable to locate"
520520
" pdv_host_id: %d\n", pdv->pdv_host_id);
521-
return PTR_ERR(sh);
521+
return -EINVAL;
522522
}
523523
}
524524
} else {

0 commit comments

Comments
 (0)