aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_proc.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2008-08-07 20:49:30 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-10-03 12:46:12 -0400
commit315cb0ad124575e75da2d0e0a95990587fc23485 (patch)
tree1efbc6b9b744163bb542ea3eec87bdb4786b598a /drivers/scsi/scsi_proc.c
parent6f92a6a7ddba5ae7ca0f0255d46410465dcf2ba6 (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_proc.c')
-rw-r--r--drivers/scsi/scsi_proc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index c6a904a45bf9..82f7b2dd08a2 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -259,8 +259,8 @@ static int scsi_add_single_device(uint host, uint channel, uint id, uint lun)
259 int error = -ENXIO; 259 int error = -ENXIO;
260 260
261 shost = scsi_host_lookup(host); 261 shost = scsi_host_lookup(host);
262 if (IS_ERR(shost)) 262 if (!shost)
263 return PTR_ERR(shost); 263 return error;
264 264
265 if (shost->transportt->user_scan) 265 if (shost->transportt->user_scan)
266 error = shost->transportt->user_scan(shost, channel, id, lun); 266 error = shost->transportt->user_scan(shost, channel, id, lun);
@@ -287,8 +287,8 @@ static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun)
287 int error = -ENXIO; 287 int error = -ENXIO;
288 288
289 shost = scsi_host_lookup(host); 289 shost = scsi_host_lookup(host);
290 if (IS_ERR(shost)) 290 if (!shost)
291 return PTR_ERR(shost); 291 return error;
292 sdev = scsi_device_lookup(shost, channel, id, lun); 292 sdev = scsi_device_lookup(shost, channel, id, lun);
293 if (sdev) { 293 if (sdev) {
294 scsi_remove_device(sdev); 294 scsi_remove_device(sdev);