linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] i2c: cadence: Add an error handling for platform_get_irq()
@ 2020-05-20 14:48 Dejin Zheng
  2020-05-22 11:24 ` Michal Simek
  0 siblings, 1 reply; 7+ messages in thread
From: Dejin Zheng @ 2020-05-20 14:48 UTC (permalink / raw)
  To: michal.simek, wsa, harinik, soren.brinkmann, linux-i2c
  Cc: linux-kernel, Dejin Zheng

The driver initialization should be end immediately after found
the platform_get_irq() function return an error.

Fixes: df8eb5691c48d3b0 ("i2c: Add driver for Cadence I2C controller")
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
v1 -> v2:
	- add Fixes tag.

 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


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

end of thread, other threads:[~2020-05-23 15:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 14:48 [PATCH v2] i2c: cadence: Add an error handling for platform_get_irq() Dejin Zheng
2020-05-22 11:24 ` Michal Simek
2020-05-22 15:14   ` Wolfram Sang
2020-05-22 15:26     ` Michal Simek
2020-05-22 20:19       ` Wolfram Sang
2020-05-23 13:36         ` Dejin Zheng
2020-05-23 15:26   ` Dejin Zheng

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