Skip to contentSkip to conversation

irqchip: Simplify with dev_err_probe()

PATCH Superseded Yan Zhen 3 participants 3 messages Aug 30, 2024

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yan Zhen

author
#0 lore raw

PATCH v2 1/1 irqchip: Simplify with dev_err_probe()

Switch to use dev_err_probe() to simplify the error path and unify a message template.

Using this helper is totally fine even if err is known to never be -EPROBE_DEFER.

The benefit compared to a normal dev_err() is the standardized format of the error code, it being emitted symbolically and the fact that the error code is returned which allows more compact error paths.

---

Changes in v2:
-Rewrite the subject.
-Remove 'ret' from the message.

 drivers/irqchip/irq-madera.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/irqchip/irq-madera.c +2 -3
index acceb6e7fa95..d5ad4466a140 100644
@@ -199,9 +199,8 @@ static int madera_irq_probe(struct platform_device *pdev)
 		ret = regmap_update_bits(madera->regmap, MADERA_IRQ1_CTRL,
 					 MADERA_IRQ_POL_MASK, 0);
 		if (ret) {
-			dev_err(&pdev->dev,
-				"Failed to set IRQ polarity: %d\n", ret);
-			return ret;
+			return dev_err_probe(&pdev->dev, ret,
+						"Failed to set IRQ polarity");
 		}
 	}
 
Signature · 1 line
2.34.1
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Yan Zhen

Switch to use dev_err_probe() to simplify the error path and unify a message template.

Using this helper is totally fine even if err is known to never be -EPROBE_DEFER.

Quoted 6 lines

The benefit compared to a normal dev_err() is the standardized format of the error code, it being emitted symbolically and the fact that the error code is returned which allows more compact error paths.

---

Subject line probably should be irqchip/madera: but otherwise:

Thanks,
Charles

#2 lore raw
Quoted 11 lines · Charles Keepax
Quoted 10 lines · Yan Zhen

Switch to use dev_err_probe() to simplify the error path and unify a message template.

Using this helper is totally fine even if err is known to never be -EPROBE_DEFER.

The benefit compared to a normal dev_err() is the standardized format of the error code, it being emitted symbolically and the fact that the error code is returned which allows more compact error paths.

Quoted 6 lines
Quoted 2 lines

---

Subject line probably should be irqchip/madera: but otherwise:

No, this must stop. Do not change one line per patch.

Best regards,
Krzysztof