From: Alan Stern Adds a missing check for an error return code from scsi_sysfs_add_sdev. This resolves entry #4863 in the OSDL bugzilla. Although in that bug report the failure occurred because of a confusion over scanning vs. rescanning, in general add_sdev can fail for a number of reasons (the simplest being insufficient memory) and the caller should cope properly. Signed-off-by: Alan Stern Cc: James Bottomley Signed-off-by: Andrew Morton --- drivers/scsi/scsi_scan.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) diff -puN drivers/scsi/scsi_scan.c~scsi_scan-check-return-code-from-scsi_sysfs_add_sdev drivers/scsi/scsi_scan.c --- devel/drivers/scsi/scsi_scan.c~scsi_scan-check-return-code-from-scsi_sysfs_add_sdev 2005-07-26 00:37:36.000000000 -0700 +++ devel-akpm/drivers/scsi/scsi_scan.c 2005-07-26 00:37:36.000000000 -0700 @@ -756,7 +756,8 @@ static int scsi_add_lun(struct scsi_devi * register it and tell the rest of the kernel * about it. */ - scsi_sysfs_add_sdev(sdev); + if (scsi_sysfs_add_sdev(sdev) != 0) + return SCSI_SCAN_NO_RESPONSE; return SCSI_SCAN_LUN_PRESENT; } _