Skip to content

Commit bd05086

Browse files
committed
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>
1 parent ec0ffe2 commit bd05086

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎drivers/base/platform.c‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,19 +1245,20 @@ static int __init early_platform_driver_probe_id(char *class_str,
12451245
* rest of the driver core is initialized.
12461246
*/
12471247
if (!match->dev.init_name) {
1248-
char buf[32];
1249-
12501248
if (match->id != -1)
1251-
snprintf(buf, sizeof(buf), "%s.%d",
1252-
match->name, match->id);
1249+
match->dev.init_name =
1250+
kasprintf(GFP_KERNEL, "%s.%d",
1251+
match->name,
1252+
match->id);
12531253
else
1254-
snprintf(buf, sizeof(buf), "%s",
1255-
match->name);
1254+
match->dev.init_name =
1255+
kasprintf(GFP_KERNEL, "%s",
1256+
match->name);
12561257

1257-
match->dev.init_name = kstrdup(buf, GFP_KERNEL);
12581258
if (!match->dev.init_name)
12591259
return -ENOMEM;
12601260
}
1261+
12611262
if (epdrv->pdrv->probe(match))
12621263
pr_warning("%s: unable to probe %s early.\n",
12631264
class_str, match->name);

0 commit comments

Comments
 (0)