diff --git a/drivers/base/core.c b/drivers/base/core.c index 938cfcd1674e..5bbb63aa100d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -820,9 +820,7 @@ struct device_link *device_link_add(struct device *consumer, dev_bus_name(supplier), dev_name(supplier), dev_bus_name(consumer), dev_name(consumer)); if (device_register(&link->link_dev)) { - put_device(consumer); - put_device(supplier); - kfree(link); + put_device(&link->link_dev); link = NULL; goto out; }