mirror of
https://github.com/torvalds/linux.git
synced 2026-01-12 00:42:35 +08:00
mmc: cavium: Use devm_mmc_alloc_host() helper
Use new function devm_mmc_alloc_host() to simplify the code. Cc: Robert Richter <rric@kernel.org> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Link: https://lore.kernel.org/r/9a7715ac3045d925cf2e88e23dca7acb17376468.1748933789.git.zhoubinbin@loongson.cn Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
@@ -1012,7 +1012,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
|
||||
struct mmc_host *mmc;
|
||||
int ret, id;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct cvm_mmc_slot), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*slot));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1022,7 +1022,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
|
||||
|
||||
ret = cvm_mmc_of_parse(dev, slot);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
id = ret;
|
||||
|
||||
/* Set up host parameters */
|
||||
@@ -1066,12 +1066,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
|
||||
if (ret) {
|
||||
dev_err(dev, "mmc_add_host() returned %d\n", ret);
|
||||
slot->host->slot[id] = NULL;
|
||||
goto error;
|
||||
}
|
||||
return 0;
|
||||
|
||||
error:
|
||||
mmc_free_host(slot->mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1079,6 +1074,5 @@ int cvm_mmc_of_slot_remove(struct cvm_mmc_slot *slot)
|
||||
{
|
||||
mmc_remove_host(slot->mmc);
|
||||
slot->host->slot[slot->bus_id] = NULL;
|
||||
mmc_free_host(slot->mmc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user