Messages in this thread Patch in this message | | | From | Tang Bin <> | Subject | [PATCH] mfd: asic3: Add error checking return in asic3_mfd_probe() | Date | Sun, 19 Apr 2020 17:19:23 +0800 |
| |
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
| |