.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2014 Samsung Electronics Co., Ltd. |
---|
3 | 4 | * Sylwester Nawrocki <s.nawrocki@samsung.com> |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License version 2 as |
---|
7 | | - * published by the Free Software Foundation. |
---|
8 | 5 | */ |
---|
9 | 6 | |
---|
10 | 7 | #include <linux/clk.h> |
---|
.. | .. |
---|
13 | 10 | #include <linux/device.h> |
---|
14 | 11 | #include <linux/of.h> |
---|
15 | 12 | #include <linux/printk.h> |
---|
16 | | -#include "clk.h" |
---|
17 | 13 | |
---|
18 | 14 | static int __set_clk_parents(struct device_node *node, bool clk_supplier) |
---|
19 | 15 | { |
---|
.. | .. |
---|
37 | 33 | else |
---|
38 | 34 | return rc; |
---|
39 | 35 | } |
---|
40 | | - if (clkspec.np == node && !clk_supplier) |
---|
| 36 | + if (clkspec.np == node && !clk_supplier) { |
---|
| 37 | + of_node_put(clkspec.np); |
---|
41 | 38 | return 0; |
---|
42 | | - pclk = of_clk_get_from_provider_with_orphans(&clkspec); |
---|
| 39 | + } |
---|
| 40 | + pclk = of_clk_get_from_provider(&clkspec); |
---|
| 41 | + of_node_put(clkspec.np); |
---|
43 | 42 | if (IS_ERR(pclk)) { |
---|
44 | 43 | if (PTR_ERR(pclk) != -EPROBE_DEFER) |
---|
45 | 44 | pr_warn("clk: couldn't get parent clock %d for %pOF\n", |
---|
.. | .. |
---|
52 | 51 | if (rc < 0) |
---|
53 | 52 | goto err; |
---|
54 | 53 | if (clkspec.np == node && !clk_supplier) { |
---|
| 54 | + of_node_put(clkspec.np); |
---|
55 | 55 | rc = 0; |
---|
56 | 56 | goto err; |
---|
57 | 57 | } |
---|
58 | | - clk = of_clk_get_from_provider_with_orphans(&clkspec); |
---|
| 58 | + clk = of_clk_get_from_provider(&clkspec); |
---|
| 59 | + of_node_put(clkspec.np); |
---|
59 | 60 | if (IS_ERR(clk)) { |
---|
60 | 61 | if (PTR_ERR(clk) != -EPROBE_DEFER) |
---|
61 | 62 | pr_warn("clk: couldn't get assigned clock %d for %pOF\n", |
---|
.. | .. |
---|
97 | 98 | else |
---|
98 | 99 | return rc; |
---|
99 | 100 | } |
---|
100 | | - if (clkspec.np == node && !clk_supplier) |
---|
| 101 | + if (clkspec.np == node && !clk_supplier) { |
---|
| 102 | + of_node_put(clkspec.np); |
---|
101 | 103 | return 0; |
---|
| 104 | + } |
---|
102 | 105 | |
---|
103 | 106 | clk = of_clk_get_from_provider(&clkspec); |
---|
| 107 | + of_node_put(clkspec.np); |
---|
104 | 108 | if (IS_ERR(clk)) { |
---|
105 | 109 | if (PTR_ERR(clk) != -EPROBE_DEFER) |
---|
106 | 110 | pr_warn("clk: couldn't get clock %d for %pOF\n", |
---|