Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Binbin Zhou and committed by
Ulf Hansson
f32b90e6 5f0aa2f7

+2 -8
+2 -8
drivers/mmc/host/cavium.c
··· 1012 1012 struct mmc_host *mmc; 1013 1013 int ret, id; 1014 1014 1015 - mmc = mmc_alloc_host(sizeof(struct cvm_mmc_slot), dev); 1015 + mmc = devm_mmc_alloc_host(dev, sizeof(*slot)); 1016 1016 if (!mmc) 1017 1017 return -ENOMEM; 1018 1018 ··· 1022 1022 1023 1023 ret = cvm_mmc_of_parse(dev, slot); 1024 1024 if (ret < 0) 1025 - goto error; 1025 + return ret; 1026 1026 id = ret; 1027 1027 1028 1028 /* Set up host parameters */ ··· 1066 1066 if (ret) { 1067 1067 dev_err(dev, "mmc_add_host() returned %d\n", ret); 1068 1068 slot->host->slot[id] = NULL; 1069 - goto error; 1070 1069 } 1071 - return 0; 1072 - 1073 - error: 1074 - mmc_free_host(slot->mmc); 1075 1070 return ret; 1076 1071 } 1077 1072 ··· 1074 1079 { 1075 1080 mmc_remove_host(slot->mmc); 1076 1081 slot->host->slot[slot->bus_id] = NULL; 1077 - mmc_free_host(slot->mmc); 1078 1082 return 0; 1079 1083 }