diff options
author | James Smart <James.Smart@Emulex.Com> | 2008-08-08 02:49:30 +0200 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-10-03 18:46:12 +0200 |
commit | 315cb0ad124575e75da2d0e0a95990587fc23485 (patch) | |
tree | 1efbc6b9b744163bb542ea3eec87bdb4786b598a /drivers/scsi/hosts.c | |
parent | e1000e: update version from k4 to k6 (diff) | |
download | linux-315cb0ad124575e75da2d0e0a95990587fc23485.tar.xz linux-315cb0ad124575e75da2d0e0a95990587fc23485.zip |
[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/hosts.c')
-rw-r--r-- | drivers/scsi/hosts.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index fed0b02ebc1d..3fdbb13e80a8 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -464,7 +464,7 @@ static int __scsi_host_match(struct device *dev, void *data) struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) { struct device *cdev; - struct Scsi_Host *shost = ERR_PTR(-ENXIO); + struct Scsi_Host *shost = NULL; cdev = class_find_device(&shost_class, NULL, &hostnum, __scsi_host_match); |