diff options
-rw-r--r-- | drivers/base/bus.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 055989e94799..2d207ad30336 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -658,9 +658,10 @@ int bus_add_driver(struct device_driver *drv) | |||
658 | pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name); | 658 | pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name); |
659 | 659 | ||
660 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 660 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
661 | if (!priv) | 661 | if (!priv) { |
662 | return -ENOMEM; | 662 | error = -ENOMEM; |
663 | 663 | goto out_put_bus; | |
664 | } | ||
664 | klist_init(&priv->klist_devices, NULL, NULL); | 665 | klist_init(&priv->klist_devices, NULL, NULL); |
665 | priv->driver = drv; | 666 | priv->driver = drv; |
666 | drv->p = priv; | 667 | drv->p = priv; |
@@ -668,7 +669,7 @@ int bus_add_driver(struct device_driver *drv) | |||
668 | error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL, | 669 | error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL, |
669 | "%s", drv->name); | 670 | "%s", drv->name); |
670 | if (error) | 671 | if (error) |
671 | goto out_put_bus; | 672 | goto out_unregister; |
672 | 673 | ||
673 | if (drv->bus->p->drivers_autoprobe) { | 674 | if (drv->bus->p->drivers_autoprobe) { |
674 | error = driver_attach(drv); | 675 | error = driver_attach(drv); |