Commit 1821438a9b6a8454281ec2e151014709f641d2d5

Authored by Alan Stern
Committed by James Bottomley
1 parent 4f581b9731

[SCSI] don't reap targets upon device_add failure

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>

Showing 1 changed file with 0 additions and 3 deletions Side-by-side Diff

drivers/scsi/scsi_sysfs.c
... ... @@ -853,9 +853,6 @@
853 853 error = device_add(&starget->dev);
854 854 if (error) {
855 855 dev_err(&starget->dev, "target device_add failed, error %d\n", error);
856   - get_device(&starget->dev);
857   - scsi_target_reap(starget);
858   - put_device(&starget->dev);
859 856 return error;
860 857 }
861 858 transport_add_device(&starget->dev);