diff options
author | James Smart <James.Smart@Emulex.Com> | 2008-08-07 20:49:30 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-10-03 11:46:12 -0500 |
commit | 315cb0ad124575e75da2d0e0a95990587fc23485 (patch) | |
tree | 1efbc6b9b744163bb542ea3eec87bdb4786b598a /drivers/scsi/scsi_transport_iscsi.c | |
parent | 6f92a6a7ddba5ae7ca0f0255d46410465dcf2ba6 (diff) |
[SCSI] scsi_host_lookup: error returns and NULL pointers
This patch cleans up the behavior of scsi_host_lookup().
The original implementation attempted to use the dual role of
either returning a pointer value, or a negative error code.
User's needed to use IS_ERR() to check the result. Additionally,
the IS_ERR() macro never checks for when a NULL pointer was
returned, so a NULL pointer actually passes with a success case.
Note: scsi_host_get(), used by scsi_host_lookup(), can return
a NULL pointer.
Talk about a mudhole for the unitiated to step into....
This patch converts scsi_host_lookup() to return either NULL
or a valid pointer. The consumers were updated for the change.
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_iscsi.c')
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 043c3921164f..0ce5f7cdfe2a 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1361,7 +1361,7 @@ iscsi_tgt_dscvr(struct iscsi_transport *transport, return -EINVAL; shost = scsi_host_lookup(ev->u.tgt_dscvr.host_no); - if (IS_ERR(shost)) { + if (!shost) { printk(KERN_ERR "target discovery could not find host no %u\n", ev->u.tgt_dscvr.host_no); return -ENODEV; @@ -1387,7 +1387,7 @@ iscsi_set_host_param(struct iscsi_transport *transport, return -ENOSYS; shost = scsi_host_lookup(ev->u.set_host_param.host_no); - if (IS_ERR(shost)) { + if (!shost) { printk(KERN_ERR "set_host_param could not find host no %u\n", ev->u.set_host_param.host_no); return -ENODEV; |