[PATCH -mm] kernel/module.c: make_driver_name() can use kasrpintf()

From: Mariusz Kozlowski
Date: Mon Nov 26 2007 - 15:33:01 EST


Hello,

make_driver_name() wants kasprintf(). Compile tested, also boots fine.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@xxxxxxxxxx>

kernel/module.c | 68034 -> 67872 (-162 bytes)
kernel/module.o | 128520 -> 128328 (-192 bytes)

kernel/module.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)

--- linux-2.6.24-rc3-mm1-a/kernel/module.c 2007-11-21 17:38:25.000000000 +0100
+++ linux-2.6.24-rc3-mm1-b/kernel/module.c 2007-11-26 20:14:53.000000000 +0100
@@ -2497,15 +2497,7 @@ void print_modules(void)
#ifdef CONFIG_SYSFS
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);
- if (!driver_name)
- return NULL;
-
- sprintf(driver_name, "%s:%s", drv->bus->name, drv->name);
- return driver_name;
+ return kasprintf(GFP_KERNEL, "%s:%s", drv->bus->name, drv->name);
}

static void module_create_drivers_dir(struct module_kobject *mk)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/