2022-03-18 03:26:27

by Wangshaobo (bobo)

[permalink] [raw]
Subject: [PATCH 2/2] iio:filter:admv8818: Fix missing clk_disable_unprepare() in admv8818_clk_setup

Fix missing clk_disable_unprepare() before return from admv8818_clk_setup
in the error handling cases.

Fixes: f34fe888ad05 ("iio:filter:admv8818: add support for ADMV8818")
Signed-off-by: Wang ShaoBo <[email protected]>
---
drivers/iio/filter/admv8818.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/filter/admv8818.c b/drivers/iio/filter/admv8818.c
index 68de45fe21b4..acb436efd8b5 100644
--- a/drivers/iio/filter/admv8818.c
+++ b/drivers/iio/filter/admv8818.c
@@ -590,14 +590,22 @@ static int admv8818_clk_setup(struct admv8818_state *st)

ret = devm_add_action_or_reset(&spi->dev, admv8818_clk_disable, st);
if (ret)
- return ret;
+ goto out_clk_disable;

st->nb.notifier_call = admv8818_freq_change;
ret = clk_notifier_register(st->clkin, &st->nb);
if (ret < 0)
- return ret;
+ goto out_clk_disable;
+
+ ret = devm_add_action_or_reset(&spi->dev, admv8818_clk_notifier_unreg, st);
+ if (ret)
+ goto out_clk_disable;
+
+ return 0;

- return devm_add_action_or_reset(&spi->dev, admv8818_clk_notifier_unreg, st);
+out_clk_disable:
+ clk_disable_unprepare(st->clkin);
+ return ret;
}

static int admv8818_probe(struct spi_device *spi)
--
2.25.1


2022-03-18 05:15:07

by Wangshaobo (bobo)

[permalink] [raw]
Subject: 答复: [PATCH 2/2] iio:filter:admv8818: Fix mi ssing clk_disable_unprepare() in admv8818_clk _setup


-----?ʼ?ԭ??-----
??????: Wangshaobo (bobo)
????ʱ??: 2022??3??18?? 10:59
????: chengjian (D) <[email protected]>; liwei (GF) <[email protected]>; Wangshaobo (bobo) <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Jonathan Cameron <[email protected]>
????: [PATCH 2/2] iio:filter:admv8818: Fix missing clk_disable_unprepare() in admv8818_clk_setup

Fix missing clk_disable_unprepare() before return from admv8818_clk_setup in the error handling cases.

Fixes: f34fe888ad05 ("iio:filter:admv8818: add support for ADMV8818")
Signed-off-by: Wang ShaoBo <[email protected]>
---
drivers/iio/filter/admv8818.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/filter/admv8818.c b/drivers/iio/filter/admv8818.c index 68de45fe21b4..acb436efd8b5 100644
--- a/drivers/iio/filter/admv8818.c
+++ b/drivers/iio/filter/admv8818.c
@@ -590,14 +590,22 @@ static int admv8818_clk_setup(struct admv8818_state *st)

ret = devm_add_action_or_reset(&spi->dev, admv8818_clk_disable, st);
if (ret)
- return ret;
+ goto out_clk_disable;

admv8818_clk_disable() would do clk_disable_unprepare(), so clk_disable_unprepare() is not needed after
devm_add_action_or_reset(),there is no problem in this function.

this patch is not needed anymore.

-- wangshaobo