linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tang Bin <tangbin@cmss.chinamobile.com>
To: lee.jones@linaro.org
Cc: linux-kernel@vger.kernel.org,
	Tang Bin <tangbin@cmss.chinamobile.com>,
	Shengju Zhang <zhangshengju@cmss.chinamobile.com>
Subject: [PATCH] mfd: asic3: Add error checking return in asic3_mfd_probe()
Date: Sun, 19 Apr 2020 17:19:23 +0800	[thread overview]
Message-ID: <20200419091923.5728-1-tangbin@cmss.chinamobile.com> (raw)

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




             reply	other threads:[~2020-04-19  9:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-19  9:19 Tang Bin [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200419091923.5728-1-tangbin@cmss.chinamobile.com \
    --to=tangbin@cmss.chinamobile.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhangshengju@cmss.chinamobile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).