mmc: core: fix return value check in devm_mmc_alloc_host()
PATCH 1/1 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 418f7c2de133 ("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().
--- drivers/mmc/core/host.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/core/host.c +3 -3
@@ -599,12 +599,12 @@ struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra) dr =devres_alloc (devm_mmc_host_release,sizeof (*dr),GFP_KERNEL );if (!dr) -return ERR_PTR (-ENOMEM ); +return NULL ; host =mmc_alloc_host (extra, dev); -if (IS_ERR (host)) { +if (!host) {devres_free (dr); -return host; +return NULL ; } *dr = host;
Signature · 1 line
2.25.1
Quoted 9 lines · Yang Yingliang
mmc_alloc_host()returns NULL pointer notPTR_ERR(), if it fails, so replace theIS_ERR()check with NULL pointer check.In commit
418f7c2de133("mmc: meson-gx: usedevm_mmc_alloc_host"), it checks NULL pointer notPTR_ERR, ifdevm_mmc_alloc_host()fails, so make it to return NULL pointer to keep same withmmc_alloc_host(), the drivers don't need to change the error handle when switch to usedevm_mmc_alloc_host().
Quoted 3 lines
Fixes 80df83c2c57e ("mmc: core: add devm_mmc_alloc_host")Signed-off-by Yang Yingliang <[email protected]>---
Right, my bad.
Quoted 23 lines
drivers/mmc/core/host.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/mmc/core/host.c +3
-3@@ -599,12 +599,12 @@ struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra) dr =devres_alloc (devm_mmc_host_release,sizeof (*dr),GFP_KERNEL );if (!dr) -return ERR_PTR (-ENOMEM ); +return NULL ; host =mmc_alloc_host (extra, dev); -if (IS_ERR (host)) { +if (!host) {devres_free (dr); -return host; +return NULL ; } *dr = host;
Quoted 4 lines · Yang Yingliang
mmc_alloc_host()returns NULL pointer notPTR_ERR(), if it fails, so replace theIS_ERR()check with NULL pointer check.
Quoted 8 lines
In commit
418f7c2de133("mmc: meson-gx: usedevm_mmc_alloc_host"), it checks NULL pointer notPTR_ERR, ifdevm_mmc_alloc_host()fails, so make it to return NULL pointer to keep same withmmc_alloc_host(), the drivers don't need to change the error handle when switch to usedevm_mmc_alloc_host().Fixes 80df83c2c57e ("mmc: core: add devm_mmc_alloc_host")Signed-off-by Yang Yingliang <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 27 lines
--- drivers/mmc/core/host.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/mmc/core/host.c +3
-4@@ -599,12 +599,12 @@ struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra) dr =devres_alloc (devm_mmc_host_release,sizeof (*dr),GFP_KERNEL );if (!dr) -return ERR_PTR (-ENOMEM ); +return NULL ; host =mmc_alloc_host (extra, dev); -if (IS_ERR (host)) { +if (!host) {devres_free (dr); -return host; +return NULL ; } *dr = host; --2.25.1