]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[SCSI] don't reap targets upon device_add failure
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 18 Mar 2010 19:41:11 +0000 (15:41 -0400)
committerJames Bottomley <James.Bottomley@suse.de>
Sun, 11 Apr 2010 14:24:15 +0000 (09:24 -0500)
This patch (as1358) fixes a bug in the error pathway of
scsi_target_add().  If registration fails, the target should not be
reaped.  The reaping occurs later, when scanning is finished and all
the child devices are removed.  The current code leaves an unbalanced
value in starget->reap_ref.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/scsi_sysfs.c

index 429c9b73e3e4de02254ac71af588f334a21e877b..838a0db8ea1fa45bc2bed550705bed8363e91af9 100644 (file)
@@ -853,9 +853,6 @@ static int scsi_target_add(struct scsi_target *starget)
        error = device_add(&starget->dev);
        if (error) {
                dev_err(&starget->dev, "target device_add failed, error %d\n", error);
-               get_device(&starget->dev);
-               scsi_target_reap(starget);
-               put_device(&starget->dev);
                return error;
        }
        transport_add_device(&starget->dev);