diff options
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 67b180d855b2..2b567177ef78 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -491,11 +491,13 @@ static int device_add_attrs(struct device *dev) | |||
491 | if (device_supports_offline(dev) && !dev->offline_disabled) { | 491 | if (device_supports_offline(dev) && !dev->offline_disabled) { |
492 | error = device_create_file(dev, &dev_attr_online); | 492 | error = device_create_file(dev, &dev_attr_online); |
493 | if (error) | 493 | if (error) |
494 | goto err_remove_type_groups; | 494 | goto err_remove_dev_groups; |
495 | } | 495 | } |
496 | 496 | ||
497 | return 0; | 497 | return 0; |
498 | 498 | ||
499 | err_remove_dev_groups: | ||
500 | device_remove_groups(dev, dev->groups); | ||
499 | err_remove_type_groups: | 501 | err_remove_type_groups: |
500 | if (type) | 502 | if (type) |
501 | device_remove_groups(dev, type->groups); | 503 | device_remove_groups(dev, type->groups); |
@@ -1603,6 +1605,7 @@ device_create_groups_vargs(struct class *class, struct device *parent, | |||
1603 | goto error; | 1605 | goto error; |
1604 | } | 1606 | } |
1605 | 1607 | ||
1608 | device_initialize(dev); | ||
1606 | dev->devt = devt; | 1609 | dev->devt = devt; |
1607 | dev->class = class; | 1610 | dev->class = class; |
1608 | dev->parent = parent; | 1611 | dev->parent = parent; |
@@ -1614,7 +1617,7 @@ device_create_groups_vargs(struct class *class, struct device *parent, | |||
1614 | if (retval) | 1617 | if (retval) |
1615 | goto error; | 1618 | goto error; |
1616 | 1619 | ||
1617 | retval = device_register(dev); | 1620 | retval = device_add(dev); |
1618 | if (retval) | 1621 | if (retval) |
1619 | goto error; | 1622 | goto error; |
1620 | 1623 | ||