summaryrefslogtreecommitdiff
path: root/drivers/base/driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/driver.c')
-rw-r--r--drivers/base/driver.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index bf31a0170a48..9a6537f14401 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -133,6 +133,7 @@ int driver_add_kobj(struct device_driver *drv, struct kobject *kobj,
{
va_list args;
char *name;
+ int ret;
va_start(args, fmt);
name = kvasprintf(GFP_KERNEL, fmt, args);
@@ -141,7 +142,9 @@ int driver_add_kobj(struct device_driver *drv, struct kobject *kobj,
if (!name)
return -ENOMEM;
- return kobject_add(kobj, &drv->p->kobj, "%s", name);
+ ret = kobject_add(kobj, &drv->p->kobj, "%s", name);
+ kfree(name);
+ return ret;
}
EXPORT_SYMBOL_GPL(driver_add_kobj);