PM / Runtime: Fix rpm_resume() return value for power.no_callbacks set
[linux-2.6.git] / drivers / base / module.c
index 103be9c..db930d3 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/errno.h>
+#include <linux/slab.h>
 #include <linux/string.h>
 #include "base.h"
 
@@ -14,12 +15,10 @@ static char *make_driver_name(struct device_driver *drv)
 {
        char *driver_name;
 
-       driver_name = kmalloc(strlen(drv->name) + strlen(drv->bus->name) + 2,
-                             GFP_KERNEL);
+       driver_name = kasprintf(GFP_KERNEL, "%s:%s", drv->bus->name, drv->name);
        if (!driver_name)
                return NULL;
 
-       sprintf(driver_name, "%s:%s", drv->bus->name, drv->name);
        return driver_name;
 }