linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yangtao Li <frank.li@vivo.com>
To: miquel.raynal@bootlin.com, rafael@kernel.org,
	daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com,
	mmayer@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
	florian.fainelli@broadcom.com, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com, agross@kernel.org,
	andersson@kernel.org, konrad.dybcio@linaro.org,
	thara.gopinath@gmail.com, heiko@sntech.de,
	mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
	thierry.reding@gmail.com, jonathanh@nvidia.com,
	tglx@linutronix.de, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com,
	srinivas.pandruvada@linux.intel.com,
	DLG-Adam.Ward.opensource@dm.renesas.com, frank.li@vivo.com,
	shangxiaojing@huawei.com, bchihi@baylibre.com,
	wenst@chromium.org, u.kleine-koenig@pengutronix.de,
	hayashi.kunihiko@socionext.com,
	niklas.soderlund+renesas@ragnatech.se, chi.minghao@zte.com.cn,
	johan+linaro@kernel.org, jernej.skrabec@gmail.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: [PATCH v2 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq()
Date: Tue, 27 Jun 2023 18:12:01 +0800	[thread overview]
Message-ID: <20230627101215.58798-1-frank.li@vivo.com> (raw)

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


             reply	other threads:[~2023-06-27 10:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 10:12 Yangtao Li [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230627101215.58798-1-frank.li@vivo.com \
    --to=frank.li@vivo.com \
    --cc=DLG-Adam.Ward.opensource@dm.renesas.com \
    --cc=agross@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=amitk@kernel.org \
    --cc=andersson@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bchihi@baylibre.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=daniel.lezcano@linaro.org \
    --cc=festevam@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=heiko@sntech.de \
    --cc=jernej.skrabec@gmail.com \
    --cc=johan+linaro@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kernel@pengutronix.de \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mmayer@broadcom.com \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shangxiaojing@huawei.com \
    --cc=shawnguo@kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=thara.gopinath@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).