From: Dejin Zheng <zhengdejin5@gmail.com>
To: wsa@the-dreams.de, michal.simek@xilinx.com, linux-i2c@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Dejin Zheng <zhengdejin5@gmail.com>
Subject: [PATCH v1] i2c: cadence: Add an error handling for platform_get_irq()
Date: Tue, 19 May 2020 22:43:21 +0800 [thread overview]
Message-ID: <20200519144321.27483-1-zhengdejin5@gmail.com> (raw)
The driver initialization should be end immediately after found
the platform_get_irq() function return an error.
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
drivers/i2c/busses/i2c-cadence.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index 89d58f7d2a25..0e8debe32cea 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -912,6 +912,8 @@ static int cdns_i2c_probe(struct platform_device *pdev)
return PTR_ERR(id->membase);
id->irq = platform_get_irq(pdev, 0);
+ if (id->irq < 0)
+ return id->irq;
id->adap.owner = THIS_MODULE;
id->adap.dev.of_node = pdev->dev.of_node;
--
2.25.0
reply other threads:[~2020-05-19 14:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200519144321.27483-1-zhengdejin5@gmail.com \
--to=zhengdejin5@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=wsa@the-dreams.de \
/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).