[PATCH 2/3] staging: irda: Handle return value of platform_get_irq

Arvind Yadav arvind.yadav.cs at gmail.com
Thu Nov 30 15:43:35 UTC 2017


platform_get_irq() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs at gmail.com>
---
 drivers/staging/irda/drivers/pxaficp_ir.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/staging/irda/drivers/pxaficp_ir.c b/drivers/staging/irda/drivers/pxaficp_ir.c
index 1dba16b..a97ce04 100644
--- a/drivers/staging/irda/drivers/pxaficp_ir.c
+++ b/drivers/staging/irda/drivers/pxaficp_ir.c
@@ -960,7 +960,17 @@ static int pxa_irda_probe(struct platform_device *pdev)
 	si->irda_base = ficp;
 	si->stuart_base = stuart;
 	si->uart_irq = platform_get_irq(pdev, 0);
+	if (si->uart_irq < 0) {
+		err =  si->uart_irq;
+		goto err_mem_1;
+	}
+
 	si->icp_irq = platform_get_irq(pdev, 1);
+	if (si->icp_irq < 0) {
+		err =  si->icp_irq;
+		goto err_mem_1;
+	}
+
 
 	si->sir_clk = devm_clk_get(&pdev->dev, "UARTCLK");
 	si->fir_clk = devm_clk_get(&pdev->dev, "FICPCLK");
-- 
2.7.4



More information about the devel mailing list