diff options
author | James Bottomley <James.Bottomley@suse.de> | 2010-03-12 17:14:42 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 13:03:48 -0400 |
commit | a91c1be21704113b023919826c6d531da46656ef (patch) | |
tree | 5ac2396f83dcfbf8596d5f5cfa11d4cd5f6cc118 /drivers/misc | |
parent | aac3118d33e275a7b1134cb19227c982f4d43877 (diff) |
[SCSI] enclosure: fix error path - actually return ERR_PTR() on error
we also need to clean up and free the cdev.
Reported-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@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, | |||
285 | cdev->groups = enclosure_groups; | 285 | cdev->groups = enclosure_groups; |
286 | 286 | ||
287 | err = device_register(cdev); | 287 | err = device_register(cdev); |
288 | if (err) | 288 | if (err) { |
289 | ERR_PTR(err); | 289 | ecomp->number = -1; |
290 | put_device(cdev); | ||
291 | return ERR_PTR(err); | ||
292 | } | ||
290 | 293 | ||
291 | return ecomp; | 294 | return ecomp; |
292 | } | 295 | } |