[v2,2/6] clk: samsung: Add local variable to match it purpose

Message ID 1493016143-21569-3-git-send-email-m.szyprowski@samsung.com
State New
Headers show
Series
  • Samsung clock providers: convert to the new clk_hw API
Related show

Commit Message

Marek Szyprowski April 24, 2017, 6:42 a.m.
Add new variable to avoid using clk pointer for different purposes across
the exynos_register_cpu_clock() function. This will help in future rewrite
for the new clk_hw API.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

---
 drivers/clk/samsung/clk-cpu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Krzysztof Kozlowski April 24, 2017, 6:53 a.m. | #1
On Mon, Apr 24, 2017 at 8:42 AM, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> Add new variable to avoid using clk pointer for different purposes across

> the exynos_register_cpu_clock() function. This will help in future rewrite

> for the new clk_hw API.

>

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---

>  drivers/clk/samsung/clk-cpu.c | 7 ++++---

>  1 file changed, 4 insertions(+), 3 deletions(-)

>

> diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c

> index 8bf7e805fd34..6e1c6007e721 100644

> --- a/drivers/clk/samsung/clk-cpu.c

> +++ b/drivers/clk/samsung/clk-cpu.c

> @@ -410,6 +410,7 @@ int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,

>  {

>         struct exynos_cpuclk *cpuclk;

>         struct clk_init_data init;

> +       struct clk *parent_clk;

>         struct clk *clk;

>         int ret = 0;

>

> @@ -440,15 +441,15 @@ int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,

>                 goto free_cpuclk;

>         }

>

> -       clk = __clk_lookup(parent);

> -       if (!clk) {

> +       parent_clk = __clk_lookup(parent);

> +       if (!parent_clk) {

>                 pr_err("%s: could not lookup parent clock %s\n",

>                                 __func__, parent);

>                 ret = -EINVAL;

>                 goto free_cpuclk;

>         }

>

> -       ret = clk_notifier_register(clk, &cpuclk->clk_nb);

> +       ret = clk_notifier_register(parent_clk, &cpuclk->clk_nb);

>         if (ret) {

>                 pr_err("%s: failed to register clock notifier for %s\n",

>                                 __func__, name);


You can also remove one clk_lookup and just use "parent_clk" in error path:

478 unregister_clk_nb:
479         clk_notifier_unregister(__clk_lookup(parent), &cpuclk->clk_nb);

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch hide | download patch | download mbox

diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c
index 8bf7e805fd34..6e1c6007e721 100644
--- a/drivers/clk/samsung/clk-cpu.c
+++ b/drivers/clk/samsung/clk-cpu.c
@@ -410,6 +410,7 @@  int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,
 {
 	struct exynos_cpuclk *cpuclk;
 	struct clk_init_data init;
+	struct clk *parent_clk;
 	struct clk *clk;
 	int ret = 0;
 
@@ -440,15 +441,15 @@  int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,
 		goto free_cpuclk;
 	}
 
-	clk = __clk_lookup(parent);
-	if (!clk) {
+	parent_clk = __clk_lookup(parent);
+	if (!parent_clk) {
 		pr_err("%s: could not lookup parent clock %s\n",
 				__func__, parent);
 		ret = -EINVAL;
 		goto free_cpuclk;
 	}
 
-	ret = clk_notifier_register(clk, &cpuclk->clk_nb);
+	ret = clk_notifier_register(parent_clk, &cpuclk->clk_nb);
 	if (ret) {
 		pr_err("%s: failed to register clock notifier for %s\n",
 				__func__, name);