aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 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}