diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/platform.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index c5fbe198fbdb..765bcf0df3bb 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -1254,6 +1254,26 @@ static int __init early_platform_driver_probe_id(char *class_str, | |||
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | if (match) { | 1256 | if (match) { |
1257 | /* | ||
1258 | * Set up a sensible init_name to enable | ||
1259 | * dev_name() and others to be used before the | ||
1260 | * rest of the driver core is initialized. | ||
1261 | */ | ||
1262 | if (!match->dev.init_name && slab_is_available()) { | ||
1263 | if (match->id != -1) | ||
1264 | match->dev.init_name = | ||
1265 | kasprintf(GFP_KERNEL, "%s.%d", | ||
1266 | match->name, | ||
1267 | match->id); | ||
1268 | else | ||
1269 | match->dev.init_name = | ||
1270 | kasprintf(GFP_KERNEL, "%s", | ||
1271 | match->name); | ||
1272 | |||
1273 | if (!match->dev.init_name) | ||
1274 | return -ENOMEM; | ||
1275 | } | ||
1276 | |||
1257 | if (epdrv->pdrv->probe(match)) | 1277 | if (epdrv->pdrv->probe(match)) |
1258 | pr_warning("%s: unable to probe %s early.\n", | 1278 | pr_warning("%s: unable to probe %s early.\n", |
1259 | class_str, match->name); | 1279 | class_str, match->name); |