lkml.org 
[lkml]   [2022]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] mmc: sunlpus: Slightly simplify the error ahndling path in spmmc_drv_probe()
Date
If mmc_alloc_host() fails, we can return directly.
This saves some LoC, a test and some indentation in the error handling
path.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/mmc/host/sunplus-mmc.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/sunplus-mmc.c b/drivers/mmc/host/sunplus-mmc.c
index ed789a9bdd23..d990b120789d 100644
--- a/drivers/mmc/host/sunplus-mmc.c
+++ b/drivers/mmc/host/sunplus-mmc.c
@@ -864,10 +864,8 @@ static int spmmc_drv_probe(struct platform_device *pdev)
int ret = 0;

mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
- if (!mmc) {
- ret = -ENOMEM;
- goto probe_free_host;
- }
+ if (!mmc)
+ return -ENOMEM;

host = mmc_priv(mmc);
host->mmc = mmc;
@@ -936,8 +934,7 @@ static int spmmc_drv_probe(struct platform_device *pdev)
return ret;

probe_free_host:
- if (mmc)
- mmc_free_host(mmc);
+ mmc_free_host(mmc);

return ret;
}
--
2.34.1
\
 
 \ /
  Last update: 2022-12-10 19:37    [W:0.060 / U:1.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site