diff options
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/host.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 821cd8224137..2a3593d9f87d 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
@@ -429,19 +429,20 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) | |||
429 | int err; | 429 | int err; |
430 | struct mmc_host *host; | 430 | struct mmc_host *host; |
431 | 431 | ||
432 | if (!idr_pre_get(&mmc_host_idr, GFP_KERNEL)) | ||
433 | return NULL; | ||
434 | |||
435 | host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); | 432 | host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); |
436 | if (!host) | 433 | if (!host) |
437 | return NULL; | 434 | return NULL; |
438 | 435 | ||
439 | /* scanning will be enabled when we're ready */ | 436 | /* scanning will be enabled when we're ready */ |
440 | host->rescan_disable = 1; | 437 | host->rescan_disable = 1; |
438 | idr_preload(GFP_KERNEL); | ||
441 | spin_lock(&mmc_host_lock); | 439 | spin_lock(&mmc_host_lock); |
442 | err = idr_get_new(&mmc_host_idr, host, &host->index); | 440 | err = idr_alloc(&mmc_host_idr, host, 0, 0, GFP_NOWAIT); |
441 | if (err >= 0) | ||
442 | host->index = err; | ||
443 | spin_unlock(&mmc_host_lock); | 443 | spin_unlock(&mmc_host_lock); |
444 | if (err) | 444 | idr_preload_end(); |
445 | if (err < 0) | ||
445 | goto free; | 446 | goto free; |
446 | 447 | ||
447 | dev_set_name(&host->class_dev, "mmc%d", host->index); | 448 | dev_set_name(&host->class_dev, "mmc%d", host->index); |