* [PATCH] counter: ti-ecap-capture: Add check for clk_enable()
@ 2024-11-03 21:39 Jiasheng Jiang
2024-11-04 8:30 ` Julien Panis
2024-11-04 14:28 ` William Breathitt Gray
0 siblings, 2 replies; 4+ messages in thread
From: Jiasheng Jiang @ 2024-11-03 21:39 UTC (permalink / raw)
To: vigneshr, jpanis, wbg, gregkh
Cc: linux-iio, linux-omap, linux-kernel, Jiasheng Jiang
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")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
drivers/counter/ti-ecap-capture.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c
index 675447315caf..30a269fa5da0 100644
--- a/drivers/counter/ti-ecap-capture.c
+++ b/drivers/counter/ti-ecap-capture.c
@@ -574,8 +574,11 @@ 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)
+ return ret;
ecap_cnt_capture_set_evmode(counter_dev, ecap_dev->pm_ctx.ev_mode);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] counter: ti-ecap-capture: Add check for clk_enable()
2024-11-03 21:39 [PATCH] counter: ti-ecap-capture: Add check for clk_enable() Jiasheng Jiang
@ 2024-11-04 8:30 ` Julien Panis
2024-11-04 14:28 ` William Breathitt Gray
1 sibling, 0 replies; 4+ messages in thread
From: Julien Panis @ 2024-11-04 8:30 UTC (permalink / raw)
To: Jiasheng Jiang, vigneshr, wbg, gregkh; +Cc: linux-iio, linux-omap, linux-kernel
On 11/3/24 22:39, Jiasheng Jiang wrote:
> 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")
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
> ---
> drivers/counter/ti-ecap-capture.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c
> index 675447315caf..30a269fa5da0 100644
> --- a/drivers/counter/ti-ecap-capture.c
> +++ b/drivers/counter/ti-ecap-capture.c
> @@ -574,8 +574,11 @@ 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)
> + return ret;
>
> ecap_cnt_capture_set_evmode(counter_dev, ecap_dev->pm_ctx.ev_mode);
>
Reviewed-by: Julien Panis <jpanis@baylibre.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] counter: ti-ecap-capture: Add check for clk_enable()
2024-11-03 21:39 [PATCH] counter: ti-ecap-capture: Add check for clk_enable() Jiasheng Jiang
2024-11-04 8:30 ` Julien Panis
@ 2024-11-04 14:28 ` William Breathitt Gray
1 sibling, 0 replies; 4+ messages in thread
From: William Breathitt Gray @ 2024-11-04 14:28 UTC (permalink / raw)
To: Jiasheng Jiang
Cc: vigneshr, jpanis, gregkh, linux-iio, linux-omap, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]
On Sun, Nov 03, 2024 at 09:39:10PM +0000, Jiasheng Jiang wrote:
> 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")
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
> ---
> drivers/counter/ti-ecap-capture.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c
> index 675447315caf..30a269fa5da0 100644
> --- a/drivers/counter/ti-ecap-capture.c
> +++ b/drivers/counter/ti-ecap-capture.c
> @@ -574,8 +574,11 @@ 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)
> + return ret;
>
> ecap_cnt_capture_set_evmode(counter_dev, ecap_dev->pm_ctx.ev_mode);
>
> --
> 2.25.1
Similar to the stm32-timer-cnt patch comment: it's not necessarily clear
that an error in the cnt_resume() callback is due to a clk_enable()
failure, so you should call dev_err() before returning to indicate the
reason for the error code.
William Breathitt Gray
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] counter: ti-ecap-capture: Add check for clk_enable()
@ 2024-11-04 19:31 Jiasheng Jiang
0 siblings, 0 replies; 4+ messages in thread
From: Jiasheng Jiang @ 2024-11-04 19:31 UTC (permalink / raw)
To: wbg, vigneshr, jpanis, gregkh
Cc: linux-iio, linux-omap, linux-kernel, Jiasheng Jiang
On Mon, Nov 04, 2024 at 09:28:00AM -0500, William Breathitt Gray wrote:
> On Sun, Nov 03, 2024 at 09:39:10PM +0000, Jiasheng Jiang wrote:
> 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")
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
> ---
> drivers/counter/ti-ecap-capture.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/counter/ti-ecap-capture.c b/drivers/counter/ti-ecap-capture.c
> index 675447315caf..30a269fa5da0 100644
> --- a/drivers/counter/ti-ecap-capture.c
> +++ b/drivers/counter/ti-ecap-capture.c
> @@ -574,8 +574,11 @@ 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)
> + return ret;
>
> ecap_cnt_capture_set_evmode(counter_dev, ecap_dev->pm_ctx.ev_mode);
>
> --
> 2.25.1
>
> Similar to the stm32-timer-cnt patch comment: it's not necessarily clear
> that an error in the cnt_resume() callback is due to a clk_enable()
> failure, so you should call dev_err() before returning to indicate the
> reason for the error code.
Thanks, I will add dev_err() in my v2 patches.
-Jiasheng Jiang
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-04 19:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-03 21:39 [PATCH] counter: ti-ecap-capture: Add check for clk_enable() Jiasheng Jiang
2024-11-04 8:30 ` Julien Panis
2024-11-04 14:28 ` William Breathitt Gray
-- strict thread matches above, loose matches on Subject: below --
2024-11-04 19:31 Jiasheng Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox