diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2015-02-13 17:36:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:36 -0500 |
commit | 612936f21277d1254dd885de2e383aacdc7ca67f (patch) | |
tree | 97269bedada361560a20ef8f4fb5a2a44a2f0ef1 /drivers/clk | |
parent | dfeb0750b630b72b5d4fb2461bc7179eceb54666 (diff) |
clk: convert clock name allocations to kstrdup_const
Clock subsystem frequently performs duplication of strings located in
read-only memory section. Replacing kstrdup by kstrdup_const allows to
avoid such operations.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Greg KH <greg@kroah.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/clk.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index d48ac71c6c8b..642cf37124d3 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -2048,7 +2048,7 @@ struct clk *clk_register(struct device *dev, struct clk_hw *hw) | |||
2048 | goto fail_out; | 2048 | goto fail_out; |
2049 | } | 2049 | } |
2050 | 2050 | ||
2051 | clk->name = kstrdup(hw->init->name, GFP_KERNEL); | 2051 | clk->name = kstrdup_const(hw->init->name, GFP_KERNEL); |
2052 | if (!clk->name) { | 2052 | if (!clk->name) { |
2053 | pr_err("%s: could not allocate clk->name\n", __func__); | 2053 | pr_err("%s: could not allocate clk->name\n", __func__); |
2054 | ret = -ENOMEM; | 2054 | ret = -ENOMEM; |
@@ -2075,7 +2075,7 @@ struct clk *clk_register(struct device *dev, struct clk_hw *hw) | |||
2075 | 2075 | ||
2076 | /* copy each string name in case parent_names is __initdata */ | 2076 | /* copy each string name in case parent_names is __initdata */ |
2077 | for (i = 0; i < clk->num_parents; i++) { | 2077 | for (i = 0; i < clk->num_parents; i++) { |
2078 | clk->parent_names[i] = kstrdup(hw->init->parent_names[i], | 2078 | clk->parent_names[i] = kstrdup_const(hw->init->parent_names[i], |
2079 | GFP_KERNEL); | 2079 | GFP_KERNEL); |
2080 | if (!clk->parent_names[i]) { | 2080 | if (!clk->parent_names[i]) { |
2081 | pr_err("%s: could not copy parent_names\n", __func__); | 2081 | pr_err("%s: could not copy parent_names\n", __func__); |
@@ -2090,10 +2090,10 @@ struct clk *clk_register(struct device *dev, struct clk_hw *hw) | |||
2090 | 2090 | ||
2091 | fail_parent_names_copy: | 2091 | fail_parent_names_copy: |
2092 | while (--i >= 0) | 2092 | while (--i >= 0) |
2093 | kfree(clk->parent_names[i]); | 2093 | kfree_const(clk->parent_names[i]); |
2094 | kfree(clk->parent_names); | 2094 | kfree(clk->parent_names); |
2095 | fail_parent_names: | 2095 | fail_parent_names: |
2096 | kfree(clk->name); | 2096 | kfree_const(clk->name); |
2097 | fail_name: | 2097 | fail_name: |
2098 | kfree(clk); | 2098 | kfree(clk); |
2099 | fail_out: | 2099 | fail_out: |
@@ -2112,10 +2112,10 @@ static void __clk_release(struct kref *ref) | |||
2112 | 2112 | ||
2113 | kfree(clk->parents); | 2113 | kfree(clk->parents); |
2114 | while (--i >= 0) | 2114 | while (--i >= 0) |
2115 | kfree(clk->parent_names[i]); | 2115 | kfree_const(clk->parent_names[i]); |
2116 | 2116 | ||
2117 | kfree(clk->parent_names); | 2117 | kfree(clk->parent_names); |
2118 | kfree(clk->name); | 2118 | kfree_const(clk->name); |
2119 | kfree(clk); | 2119 | kfree(clk); |
2120 | } | 2120 | } |
2121 | 2121 | ||