lkml.org 
[lkml]   [2020]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mfd: asic3: Add error checking return in asic3_mfd_probe()
Date
In the function asic3_mfd_probe(), when get resource or irq
failed, the value returned just detected and debug error message,
but there were no error checking return. So add the right error
checking return. And remove the redundant 'ret = 0'.

Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
drivers/mfd/asic3.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 7694de3f1..827449b7a 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -881,12 +881,18 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
int irq, ret;

mem_sdio = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!mem_sdio)
+ if (!mem_sdio) {
dev_dbg(asic->dev, "no SDIO MEM resource\n");
+ ret = -EINVAL;
+ goto out;
+ }

irq = platform_get_irq(pdev, 1);
- if (irq < 0)
+ if (irq < 0) {
dev_dbg(asic->dev, "no SDIO IRQ resource\n");
+ ret = irq;
+ goto out;
+ }

/* DS1WM */
asic3_set_register(asic, ASIC3_OFFSET(EXTCF, SELECT),
@@ -924,7 +930,6 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
goto out;
}

- ret = 0;
if (pdata->leds) {
int i;

--
2.20.1.windows.1


\
 
 \ /
  Last update: 2020-04-19 11:18    [W:0.043 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site