diff mbox series

i2c: cadence: Unregister the clk notifier in error path

Message ID 20220628191216.39459-1-satish.nagireddy@getcruise.com
State Accepted
Commit 3501f0c663063513ad604fb1b3f06af637d3396d
Headers show
Series i2c: cadence: Unregister the clk notifier in error path | expand

Commit Message

Satish Nagireddy June 28, 2022, 7:12 p.m. UTC
This patch ensures that the clock notifier is unregistered
when driver probe is returning error.

Signed-off-by: Satish Nagireddy <satish.nagireddy@getcruise.com>
---
 drivers/i2c/busses/i2c-cadence.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michal Simek July 7, 2022, 8:14 a.m. UTC | #1
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 <satish.nagireddy@getcruise.com>
> ---
>   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 <michal.simek@amd.com>

Thanks,
Michal
Wolfram Sang July 7, 2022, 9:07 p.m. UTC | #2
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 <satish.nagireddy@getcruise.com>

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!
Satish Nagireddy July 7, 2022, 11:17 p.m. UTC | #3
On Thu, Jul 7, 2022 at 2:08 PM Wolfram Sang <wsa@kernel.org> 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 <satish.nagireddy@getcruise.com>
>
> 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
diff mbox series

Patch

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);