2022-06-28 19:21:14

by Satish Nagireddy

[permalink] [raw]
Subject: [PATCH] i2c: cadence: Unregister the clk notifier in error path

This patch ensures that the clock notifier is unregistered
when driver probe is returning error.

Signed-off-by: Satish Nagireddy <[email protected]>
---
drivers/i2c/busses/i2c-cadence.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index b4c1ad19cdae..3d6f8ee355bf 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -1338,6 +1338,7 @@ static int cdns_i2c_probe(struct platform_device *pdev)
return 0;

err_clk_dis:
+ clk_notifier_unregister(id->clk, &id->clk_rate_change_nb);
clk_disable_unprepare(id->clk);
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
--
2.36.1


2022-06-28 19:43:39

by Lars-Peter Clausen

[permalink] [raw]
Subject: Re: [PATCH] i2c: cadence: Unregister the clk notifier in error path

On 6/28/22 21:12, Satish Nagireddy wrote:
> This patch ensures that the clock notifier is unregistered
> when driver probe is returning error.
>
> Signed-off-by: Satish Nagireddy <[email protected]>

Thanks! Looks good.

Tested-by: Lars-Peter Clausen <[email protected]>

> ---
> drivers/i2c/busses/i2c-cadence.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index b4c1ad19cdae..3d6f8ee355bf 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -1338,6 +1338,7 @@ static int cdns_i2c_probe(struct platform_device *pdev)
> return 0;
>
> err_clk_dis:
> + clk_notifier_unregister(id->clk, &id->clk_rate_change_nb);
> clk_disable_unprepare(id->clk);
> pm_runtime_disable(&pdev->dev);
> pm_runtime_set_suspended(&pdev->dev);


2022-07-07 08:43:07

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH] i2c: cadence: Unregister the clk notifier in error path



On 6/28/22 21:12, Satish Nagireddy wrote:
> This patch ensures that the clock notifier is unregistered
> when driver probe is returning error.
>
> Signed-off-by: Satish Nagireddy <[email protected]>
> ---
> drivers/i2c/busses/i2c-cadence.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index b4c1ad19cdae..3d6f8ee355bf 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -1338,6 +1338,7 @@ static int cdns_i2c_probe(struct platform_device *pdev)
> return 0;
>
> err_clk_dis:
> + clk_notifier_unregister(id->clk, &id->clk_rate_change_nb);
> clk_disable_unprepare(id->clk);
> pm_runtime_disable(&pdev->dev);
> pm_runtime_set_suspended(&pdev->dev);
> --
> 2.36.1
>

Reviewed-by: Michal Simek <[email protected]>

Thanks,
Michal

2022-07-07 21:25:43

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c: cadence: Unregister the clk notifier in error path

On Tue, Jun 28, 2022 at 12:12:16PM -0700, Satish Nagireddy wrote:
> This patch ensures that the clock notifier is unregistered
> when driver probe is returning error.
>
> Signed-off-by: Satish Nagireddy <[email protected]>

Applied to for-current, thanks! I added a Fixes: tag. It would be great
if you had the time to provide it next time with the patch.

Happy hacking!


Attachments:
(No filename) (398.00 B)
signature.asc (849.00 B)
Download all attachments

2022-07-08 00:22:09

by Satish Nagireddy

[permalink] [raw]
Subject: Re: [EXT] Re: [PATCH] i2c: cadence: Unregister the clk notifier in error path

On Thu, Jul 7, 2022 at 2:08 PM Wolfram Sang <[email protected]> wrote:
>
> On Tue, Jun 28, 2022 at 12:12:16PM -0700, Satish Nagireddy wrote:
> > This patch ensures that the clock notifier is unregistered
> > when driver probe is returning error.
> >
> > Signed-off-by: Satish Nagireddy <[email protected]>
>
> Applied to for-current, thanks! I added a Fixes: tag. It would be great
> if you had the time to provide it next time with the patch.
>
> Happy hacking!
>

Sure, thank you!

Regards,
Satish