public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] mfd: asic3: Add error checking return in asic3_mfd_probe()
@ 2020-04-19 11:19 Markus Elfring
  2020-04-20  7:13 ` Lee Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2020-04-19 11:19 UTC (permalink / raw)
  To: Tang Bin, Shengju Zhang; +Cc: Lee Jones, linux-kernel

> 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.

I suggest to improve the commit message.
Would you like to adjust the patch subject?


> And remove the redundant 'ret = 0'.

I propose to reconsider this interpretation of the source code here.
How do you think about to move the mentioned statement into an else branch
at the end?

Regards,
Markus

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH] mfd: asic3: Add error checking return in asic3_mfd_probe()
@ 2020-04-19  9:19 Tang Bin
  0 siblings, 0 replies; 6+ messages in thread
From: Tang Bin @ 2020-04-19  9:19 UTC (permalink / raw)
  To: lee.jones; +Cc: linux-kernel, Tang Bin, Shengju Zhang

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




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-20 10:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-19 11:19 [PATCH] mfd: asic3: Add error checking return in asic3_mfd_probe() Markus Elfring
2020-04-20  7:13 ` Lee Jones
2020-04-20  8:37   ` Markus Elfring
2020-04-20  8:50     ` Lee Jones
2020-04-20 10:04       ` Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-04-19  9:19 [PATCH] " Tang Bin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox