summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@suse.de>2010-03-12 16:14:42 -0600
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 10:20:44 -0700
commit0c7607070fcdb517a4f315b2150a2d05b6b00e7c (patch)
tree23ac8a94b1930e1d6ea95853326177c039ede912
parent7a4c13ac72f77cbbaa780c7a53e6bb8d586ff2d9 (diff)
SCSI: enclosure: fix error path - actually return ERR_PTR() on error
commit a91c1be21704113b023919826c6d531da46656ef upstream. we also need to clean up and free the cdev. Reported-by: Jani Nikula <ext-jani.1.nikula@nokia.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/misc/enclosure.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 1eac626e710a..68e4cd7d321a 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -284,8 +284,11 @@ enclosure_component_register(struct enclosure_device *edev,
cdev->groups = enclosure_groups;
err = device_register(cdev);
- if (err)
- ERR_PTR(err);
+ if (err) {
+ ecomp->number = -1;
+ put_device(cdev);
+ return ERR_PTR(err);
+ }
return ecomp;
}