int err; if (!idr_pre_get(&mmc_host_idr, GFP_KERNEL)) return -ENOMEM; spin_lock(&mmc_host_lock); err = idr_get_new(&mmc_host_idr, host, &host->index); spin_unlock(&mmc_host_lock);