public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: qcom: Fix missing error check for dev_pm_domain_attach()
@ 2025-02-11  9:20 Wentao Liang
  2025-02-12 14:45 ` Markus Elfring
  2025-04-16 18:10 ` Bjorn Andersson
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2025-02-11  9:20 UTC (permalink / raw)
  To: andersson, mturquette, sboyd
  Cc: linux-arm-msm, linux-clk, linux-kernel, Wentao Liang

In the current implementation, the return value of dev_pm_domain_attach()
is not checked. This can lead to silent failures if the function fails,
as the code would continue execution and return 0, ignoring the error.

This patch adds a check for the return value of dev_pm_domain_attach().
If the function fails, an error message is logged using dev_err_probe(),
and the error is propagated to the existing error handling path `err`,
which ensures proper cleanup by calling clk_notifier_unregister().

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/clk/qcom/apcs-sdx55.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/apcs-sdx55.c b/drivers/clk/qcom/apcs-sdx55.c
index 76ece6c4a969..3ba01622d8f0 100644
--- a/drivers/clk/qcom/apcs-sdx55.c
+++ b/drivers/clk/qcom/apcs-sdx55.c
@@ -111,7 +111,11 @@ static int qcom_apcs_sdx55_clk_probe(struct platform_device *pdev)
 	 * driver, there seems to be no better place to do this. So do it here!
 	 */
 	cpu_dev = get_cpu_device(0);
-	dev_pm_domain_attach(cpu_dev, true);
+	ret = dev_pm_domain_attach(cpu_dev, true);
+	if (ret) {
+		dev_err_probe(dev, ret, "can't get PM domain: %d\n", ret);
+		goto err;
+	}
 
 	return 0;
 
-- 
2.42.0.windows.2


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

* Re: [PATCH] clk: qcom: Fix missing error check for dev_pm_domain_attach()
  2025-02-11  9:20 [PATCH] clk: qcom: Fix missing error check for dev_pm_domain_attach() Wentao Liang
@ 2025-02-12 14:45 ` Markus Elfring
  2025-04-16 18:10 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-02-12 14:45 UTC (permalink / raw)
  To: vulab, linux-clk, linux-arm-msm
  Cc: LKML, Bjorn Andersson, Michael Turquette, Stephen Boyd

…
> This patch adds a check for the return value …

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc2#n94


How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc2#n145

Regards,
Markus

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

* Re: [PATCH] clk: qcom: Fix missing error check for dev_pm_domain_attach()
  2025-02-11  9:20 [PATCH] clk: qcom: Fix missing error check for dev_pm_domain_attach() Wentao Liang
  2025-02-12 14:45 ` Markus Elfring
@ 2025-04-16 18:10 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2025-04-16 18:10 UTC (permalink / raw)
  To: mturquette, sboyd, Wentao Liang; +Cc: linux-arm-msm, linux-clk, linux-kernel


On Tue, 11 Feb 2025 17:20:17 +0800, Wentao Liang wrote:
> In the current implementation, the return value of dev_pm_domain_attach()
> is not checked. This can lead to silent failures if the function fails,
> as the code would continue execution and return 0, ignoring the error.
> 
> This patch adds a check for the return value of dev_pm_domain_attach().
> If the function fails, an error message is logged using dev_err_probe(),
> and the error is propagated to the existing error handling path `err`,
> which ensures proper cleanup by calling clk_notifier_unregister().
> 
> [...]

Applied, thanks!

[1/1] clk: qcom: Fix missing error check for dev_pm_domain_attach()
      commit: 36eb51ac8bd545b6344c05a9860e4e65ba8d7a62

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

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

end of thread, other threads:[~2025-04-16 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-11  9:20 [PATCH] clk: qcom: Fix missing error check for dev_pm_domain_attach() Wentao Liang
2025-02-12 14:45 ` Markus Elfring
2025-04-16 18:10 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox