[PATCH] soc: qcom: llcc-qcom: Handle errors from optional IRQ lookup

[email protected]
Newsgroups org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: bui duc phuc <[email protected]>

platform_get_irq_optional() can return errors such as -EPROBE_DEFER,
but the driver currently stores the return value directly in
drv_data->ecc_irq and continues probing.

Propagate negative errors other than -ENXIO using dev_err_probe(), and
only assign the IRQ to drv_data->ecc_irq when a valid IRQ number is
returned.

Signed-off-by: bui duc phuc <[email protected]>
---
 drivers/soc/qcom/llcc-qcom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
index 8948b5fd42d2..e42946810b50 100644
--- a/drivers/soc/qcom/llcc-qcom.c
+++ b/drivers/soc/qcom/llcc-qcom.c
@@ -5587,7 +5587,12 @@ static int qcom_llcc_probe(struct platform_device *pdev)
 			goto err;
 	}
 
-	drv_data->ecc_irq = platform_get_irq_optional(pdev, 0);
+	ret = platform_get_irq_optional(pdev, 0);
+	if (ret < 0 && ret != -ENXIO)
+		return dev_err_probe(&pdev->dev, ret, "failed to get IRQ resource\n");
+	if (ret > 0)
+		drv_data->ecc_irq = ret;
+
 	drv_data->edac_reg_offset = cfg->edac_reg_offset;
 	drv_data->ecc_irq_configured = cfg->irq_configured;
 	drv_data->dev = dev;
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.