diff options
author | James Bottomley <James.Bottomley@suse.de> | 2010-03-12 16:14:42 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 10:54:13 -0700 |
commit | 439dd83ace847a78e374bca22418bd9e8ffc06cb (patch) | |
tree | 14adfd51fbac899549c9d4da22180b3688f10d79 /drivers/misc | |
parent | 6f3748cccb3c3a02265deb4cd66948d4ce2755d3 (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>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/enclosure.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c index 48c84a58163e..00e5fcac8fdf 100644 --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -285,8 +285,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; } |