diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2015-09-14 05:29:39 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2015-10-07 07:11:29 -0400 |
commit | f6c1a8a6ce19d30c235ef0fa285d5110aafaefe2 (patch) | |
tree | 0c548343a344607af8fd1788be14f11bd0901987 /arch/arm/mach-davinci | |
parent | d1a31e975738c215f450f3d7c15d5fb96942a866 (diff) |
ARM: davinci: clock: Correct return values for API functions
Fix the values returned by the publicly used functions.
These function should return 0 when they are called with clk == NULL in
similar manner as the clock API does to avoid different behavior in drivers
used by daVinci and other architectures.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r-- | arch/arm/mach-davinci/clock.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c index c70bb0a4dfb4..3caff9637a82 100644 --- a/arch/arm/mach-davinci/clock.c +++ b/arch/arm/mach-davinci/clock.c | |||
@@ -97,7 +97,9 @@ int clk_enable(struct clk *clk) | |||
97 | { | 97 | { |
98 | unsigned long flags; | 98 | unsigned long flags; |
99 | 99 | ||
100 | if (clk == NULL || IS_ERR(clk)) | 100 | if (!clk) |
101 | return 0; | ||
102 | else if (IS_ERR(clk)) | ||
101 | return -EINVAL; | 103 | return -EINVAL; |
102 | 104 | ||
103 | spin_lock_irqsave(&clockfw_lock, flags); | 105 | spin_lock_irqsave(&clockfw_lock, flags); |
@@ -124,7 +126,7 @@ EXPORT_SYMBOL(clk_disable); | |||
124 | unsigned long clk_get_rate(struct clk *clk) | 126 | unsigned long clk_get_rate(struct clk *clk) |
125 | { | 127 | { |
126 | if (clk == NULL || IS_ERR(clk)) | 128 | if (clk == NULL || IS_ERR(clk)) |
127 | return -EINVAL; | 129 | return 0; |
128 | 130 | ||
129 | return clk->rate; | 131 | return clk->rate; |
130 | } | 132 | } |
@@ -159,8 +161,10 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
159 | unsigned long flags; | 161 | unsigned long flags; |
160 | int ret = -EINVAL; | 162 | int ret = -EINVAL; |
161 | 163 | ||
162 | if (clk == NULL || IS_ERR(clk)) | 164 | if (!clk) |
163 | return ret; | 165 | return 0; |
166 | else if (IS_ERR(clk)) | ||
167 | return -EINVAL; | ||
164 | 168 | ||
165 | if (clk->set_rate) | 169 | if (clk->set_rate) |
166 | ret = clk->set_rate(clk, rate); | 170 | ret = clk->set_rate(clk, rate); |
@@ -181,7 +185,9 @@ int clk_set_parent(struct clk *clk, struct clk *parent) | |||
181 | { | 185 | { |
182 | unsigned long flags; | 186 | unsigned long flags; |
183 | 187 | ||
184 | if (clk == NULL || IS_ERR(clk)) | 188 | if (!clk) |
189 | return 0; | ||
190 | else if (IS_ERR(clk)) | ||
185 | return -EINVAL; | 191 | return -EINVAL; |
186 | 192 | ||
187 | /* Cannot change parent on enabled clock */ | 193 | /* Cannot change parent on enabled clock */ |