[PATCH v1] i2c: cadence: Add an error handling for platform_get_irq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Dejin Zheng <zhengdejin5@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux