[PATCH v2] counter: ti-ecap-capture: Add check for clk_enable()

Jiasheng Jiang posted 1 patch 2 weeks, 5 days ago
drivers/counter/ti-ecap-capture.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
[PATCH v2] counter: ti-ecap-capture: Add check for clk_enable()
Posted by Jiasheng Jiang 2 weeks, 5 days ago
Add check for the return value of clk_enable() in order to catch the
potential exception.

Fixes: 4e2f42aa00b6 ("counter: ti-ecap-capture: capture driver support for ECAP")
Reviewed-by: Julien Panis <jpanis@baylibre.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
Changelog:

v1 -> v2:

1. Add dev_err() to indicate the reason for the error code.
---
 drivers/counter/ti-ecap-capture.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c
index 675447315caf..b119aeede693 100644
--- a/drivers/counter/ti-ecap-capture.c
+++ b/drivers/counter/ti-ecap-capture.c
@@ -574,8 +574,13 @@ static int ecap_cnt_resume(struct device *dev)
 {
 	struct counter_device *counter_dev = dev_get_drvdata(dev);
 	struct ecap_cnt_dev *ecap_dev = counter_priv(counter_dev);
+	int ret;
 
-	clk_enable(ecap_dev->clk);
+	ret = clk_enable(ecap_dev->clk);
+	if (ret) {
+		dev_err(dev, "Cannot enable clock %d\n", ret);
+		return ret;
+	}
 
 	ecap_cnt_capture_set_evmode(counter_dev, ecap_dev->pm_ctx.ev_mode);
 
-- 
2.25.1
Re: [PATCH v2] counter: ti-ecap-capture: Add check for clk_enable()
Posted by William Breathitt Gray 2 weeks, 5 days ago
On Mon, 04 Nov 2024 19:40:59 +0000, Jiasheng Jiang wrote:
> Add check for the return value of clk_enable() in order to catch the
> potential exception.
> 
> 

Applied, thanks!

[1/1] counter: ti-ecap-capture: Add check for clk_enable()
      commit: 1437d9f1c56fce9c24e566508bce1d218dd5497a

Best regards,
-- 
William Breathitt Gray <wbg@kernel.org>