diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-03-29 02:51:35 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-03-29 02:51:35 -0400 |
commit | bd05086bbe3f241cd552068f9ceba9e19c6ce427 (patch) | |
tree | 5d8e28676693907f78b5666af7d6bb7e94c1f855 /drivers/base | |
parent | ec0ffe2ee0e0fb9da4409d86bfd72636450f32df (diff) |
driver core: Convert to kasprintf() for early dev_name().
This is just a simple refactoring patch on top of the early dev_name()
support, converting from kstrdup() to kasprintf() as suggested by Kay.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/platform.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index d2d4926c5c4c..f2377f3d95e5 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -1245,19 +1245,20 @@ static int __init early_platform_driver_probe_id(char *class_str, | |||
1245 | * rest of the driver core is initialized. | 1245 | * rest of the driver core is initialized. |
1246 | */ | 1246 | */ |
1247 | if (!match->dev.init_name) { | 1247 | if (!match->dev.init_name) { |
1248 | char buf[32]; | ||
1249 | |||
1250 | if (match->id != -1) | 1248 | if (match->id != -1) |
1251 | snprintf(buf, sizeof(buf), "%s.%d", | 1249 | match->dev.init_name = |
1252 | match->name, match->id); | 1250 | kasprintf(GFP_KERNEL, "%s.%d", |
1251 | match->name, | ||
1252 | match->id); | ||
1253 | else | 1253 | else |
1254 | snprintf(buf, sizeof(buf), "%s", | 1254 | match->dev.init_name = |
1255 | match->name); | 1255 | kasprintf(GFP_KERNEL, "%s", |
1256 | match->name); | ||
1256 | 1257 | ||
1257 | match->dev.init_name = kstrdup(buf, GFP_KERNEL); | ||
1258 | if (!match->dev.init_name) | 1258 | if (!match->dev.init_name) |
1259 | return -ENOMEM; | 1259 | return -ENOMEM; |
1260 | } | 1260 | } |
1261 | |||
1261 | if (epdrv->pdrv->probe(match)) | 1262 | if (epdrv->pdrv->probe(match)) |
1262 | pr_warning("%s: unable to probe %s early.\n", | 1263 | pr_warning("%s: unable to probe %s early.\n", |
1263 | class_str, match->name); | 1264 | class_str, match->name); |