Skip to contentSkip to conversation

soc: qcom: llcc-qcom: Handle errors from optional IRQ lookup

PATCH In review [email protected] 2 participants 3 messages Aug 10 – Aug 18

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: qcom: llcc-qcom: Handle errors from optional IRQ lookup

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.

---
 drivers/soc/qcom/llcc-qcom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/soc/qcom/llcc-qcom.c +6 -1
index 8948b5fd42d2..e42946810b50 100644
@@ -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;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 20 lines · On 8/10/26 7:10 AM, [email protected] wrote:

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.

---
 drivers/soc/qcom/llcc-qcom.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/soc/qcom/llcc-qcom.c +0 -0
index 8948b5fd42d2..e42946810b50 100644

drivers/soc/qcom/llcc-qcom.c static int qcom_llcc_probe(struct platform_device *pdev) · line 5594

Quoted 9 lines
drivers/soc/qcom/llcc-qcom.c +5 -1
@@ -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;

Techinically you can drop the second if-statement

Konrad

#2 lore raw

Hi Konrad,

Thank you for your review.

Quoted 10 lines

drivers/soc/qcom/llcc-qcom.c static int qcom_llcc_probe(struct platform_device *pdev) · line 5594

Quoted 7 lines
drivers/soc/qcom/llcc-qcom.c +5 -1
-     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;

Techinically you can drop the second if-statement

You are right. I checked the handling of ecc_irq here:

https://elixir.bootlin.com/linux/v7.2-rc7/source/drivers/edac/qcom_edac.c#L369

It already checks for > 0 before calling devm_request_irq(). So the second if statement can be removed entirely. I will send v2 shortly.

Best regards,
Phuc