Linux ARM-MSM sub-architecture
 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 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq()
Date: Tue, 27 Jun 2023 15:16:52 +0800	[thread overview]
Message-ID: <20230627071707.77659-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.
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..94039a915218 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(dev, "Failed to request threaded irq\n");
 		devres_free(dr);
 		return rc;
 	}
-- 
2.39.0


             reply	other threads:[~2023-06-27  7:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27  7:16 Yangtao Li [this message]
2023-06-27  7:16 ` [PATCH 02/15] thermal/drivers/armada: remove redundant msg Yangtao Li
2023-06-27  7:16 ` [PATCH 03/15] thermal/drivers/brcmstb_thermal: " Yangtao Li
2023-06-27  7:16 ` [PATCH 04/15] thermal/drivers/db8500: " Yangtao Li
2023-06-27  7:16 ` [PATCH 05/15] thermal/drivers/hisi: " Yangtao Li
2023-06-27  7:16 ` [PATCH 06/15] thermal/drivers/imx: " Yangtao Li
2023-06-27  7:16 ` [PATCH 07/15] thermal/drivers/qcom: " Yangtao Li
2023-06-27  7:16 ` [PATCH 08/15] thermal/drivers/tegra-soctherm: " Yangtao Li
2023-06-27  7:17 ` [PATCH 09/15] thermal/drivers/maxim: " Yangtao Li
2023-06-27  7:17 ` [PATCH 10/15] thermal/drivers/int340x: " Yangtao Li
2023-06-27  7:17 ` [PATCH 11/15] thermal/drivers/intel: " Yangtao Li
2023-06-27  7:17 ` [PATCH 12/15] thermal/drivers/stm: " Yangtao Li
2023-06-27  7:17 ` [PATCH 13/15] thermal/drivers/rockchip: " Yangtao Li
2023-06-27  7:40   ` Krzysztof Kozlowski
2023-06-27  7:44     ` Krzysztof Kozlowski
2023-06-27  7:17 ` [PATCH 14/15] thermal/drivers/tegra: " Yangtao Li
2023-06-27  7:17 ` [PATCH 15/15] thermal/drivers/mediatek/lvts_thermal: " Yangtao Li
2023-06-27  7:43 ` [PATCH 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Krzysztof Kozlowski
2023-07-03  9:10   ` Yangtao Li
2023-07-03 11:38     ` Krzysztof Kozlowski
2023-06-27  8:49 ` Uwe Kleine-König

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=20230627071707.77659-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