Skip to content

Commit 71d0453

Browse files
Yang Yingliangstorulf
authored andcommitted
mmc: core: fix return value check in devm_mmc_alloc_host()
mmc_alloc_host() returns NULL pointer not PTR_ERR(), if it fails, so replace the IS_ERR() check with NULL pointer check. In commit 418f7c2 ("mmc: meson-gx: use devm_mmc_alloc_host"), it checks NULL pointer not PTR_ERR, if devm_mmc_alloc_host() fails, so make it to return NULL pointer to keep same with mmc_alloc_host(), the drivers don't need to change the error handle when switch to use devm_mmc_alloc_host(). Fixes: 80df83c ("mmc: core: add devm_mmc_alloc_host") Signed-off-by: Yang Yingliang <[email protected]> Reviewed-by: Heiner Kallweit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent f0c5b32 commit 71d0453

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/mmc/core/host.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,12 +599,12 @@ struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra)
599599

600600
dr = devres_alloc(devm_mmc_host_release, sizeof(*dr), GFP_KERNEL);
601601
if (!dr)
602-
return ERR_PTR(-ENOMEM);
602+
return NULL;
603603

604604
host = mmc_alloc_host(extra, dev);
605-
if (IS_ERR(host)) {
605+
if (!host) {
606606
devres_free(dr);
607-
return host;
607+
return NULL;
608608
}
609609

610610
*dr = host;

0 commit comments

Comments
 (0)