linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq()
@ 2023-06-27 10:12 Yangtao Li
  2023-06-27 10:12 ` [PATCH v2 02/15] thermal/drivers/armada: remove redundant msg Yangtao Li
                   ` (16 more replies)
  0 siblings, 17 replies; 25+ messages in thread
From: Yangtao Li @ 2023-06-27 10:12 UTC (permalink / raw)
  To: miquel.raynal, rafael, daniel.lezcano, amitk, rui.zhang, mmayer,
	bcm-kernel-feedback-list, florian.fainelli, shawnguo, s.hauer,
	kernel, festevam, linux-imx, agross, andersson, konrad.dybcio,
	thara.gopinath, heiko, mcoquelin.stm32, alexandre.torgue,
	thierry.reding, jonathanh, tglx, matthias.bgg,
	angelogioacchino.delregno, srinivas.pandruvada,
	DLG-Adam.Ward.opensource, frank.li, shangxiaojing, bchihi, wenst,
	u.kleine-koenig, hayashi.kunihiko, niklas.soderlund+renesas,
	chi.minghao, johan+linaro, jernej.skrabec
  Cc: linux-pm, linux-kernel, linux-arm-kernel, linux-arm-msm,
	linux-rockchip, linux-stm32, linux-tegra, linux-mediatek

Ensure that all error handling branches print error information. In this
way, when this function fails, the upper-layer functions can directly
return an error code without missing debugging information. Otherwise,
the error message will be printed redundantly or missing.

There are more than 700 calls to the devm_request_threaded_irq method.
Most drivers only request one interrupt resource, and these error
messages are basically the same. If error messages are printed
everywhere, more than 1000 lines of code can be saved by removing the
msg in the driver.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 kernel/irq/devres.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
index f6e5515ee077..fcb946ffb7ec 100644
--- a/kernel/irq/devres.c
+++ b/kernel/irq/devres.c
@@ -58,8 +58,10 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
 
 	dr = devres_alloc(devm_irq_release, sizeof(struct irq_devres),
 			  GFP_KERNEL);
-	if (!dr)
+	if (!dr) {
+		dev_err(dev, "Failed to allocate device resource data\n");
 		return -ENOMEM;
+	}
 
 	if (!devname)
 		devname = dev_name(dev);
@@ -67,6 +69,7 @@ int devm_request_threaded_irq(struct device *dev, unsigned int irq,
 	rc = request_threaded_irq(irq, handler, thread_fn, irqflags, devname,
 				  dev_id);
 	if (rc) {
+		dev_err_probe(dev, rc, "Failed to request threaded irq%d: %d\n", irq, rc);
 		devres_free(dr);
 		return rc;
 	}
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-07-03 16:09 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 10:12 [PATCH v2 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
2023-06-27 10:12 ` [PATCH v2 02/15] thermal/drivers/armada: remove redundant msg Yangtao Li
2023-06-27 10:12 ` [PATCH v2 03/15] thermal/drivers/brcmstb_thermal: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 04/15] thermal/drivers/db8500: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 05/15] thermal/drivers/hisi: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 06/15] thermal/drivers/imx: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 07/15] thermal/drivers/qcom: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 08/15] thermal/drivers/tegra-soctherm: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 09/15] thermal/drivers/maxim: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 10/15] thermal/drivers/int340x: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 11/15] thermal/drivers/intel: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 12/15] thermal/drivers/stm: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 13/15] thermal/drivers/rockchip: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 14/15] thermal/drivers/tegra: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 15/15] thermal/drivers/mediatek/lvts_thermal: " Yangtao Li
2023-06-27 10:28 ` [PATCH v2 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Krzysztof Kozlowski
2023-06-27 11:00 ` Uwe Kleine-König
2023-06-30 11:11   ` Thomas Gleixner
2023-07-03  9:13     ` Yangtao Li
2023-07-03  9:53       ` Uwe Kleine-König
2023-07-03 11:37         ` Yangtao Li
2023-07-03 12:15     ` Yangtao Li
2023-07-03 12:19     ` Yangtao Li
     [not found]     ` <247a8166-f131-2d07-ec2b-479a4c19297f@vivo.com>
2023-07-03 12:28       ` Krzysztof Kozlowski
2023-07-03 16:07 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).