Skip to content

Commit

Permalink
clk: Make clk_get_rate() return 0 on error
Browse files Browse the repository at this point in the history
Most users of clk_get_rate() actually assume a non zero
return value as a valid rate returned. Returing -EINVAL
might confuse such users, so make it instead return zero
on error.

Besides the return value of clk_get_rate seems to be
'unsigned long'.

Signed-off-by: Rajendra nayak <rnayak@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
  • Loading branch information
Rajendra Nayak authored and Mike Turquette committed Apr 24, 2012
1 parent bffad66 commit 34e44fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/clk/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ unsigned long __clk_get_rate(struct clk *clk)
unsigned long ret;

if (!clk) {
ret = -EINVAL;
ret = 0;
goto out;
}

Expand All @@ -295,7 +295,7 @@ unsigned long __clk_get_rate(struct clk *clk)
goto out;

if (!clk->parent)
ret = -ENODEV;
ret = 0;

out:
return ret;
Expand Down Expand Up @@ -560,7 +560,7 @@ EXPORT_SYMBOL_GPL(clk_enable);
* @clk: the clk whose rate is being returned
*
* Simply returns the cached rate of the clk. Does not query the hardware. If
* clk is NULL then returns -EINVAL.
* clk is NULL then returns 0.
*/
unsigned long clk_get_rate(struct clk *clk)
{
Expand Down

0 comments on commit 34e44fe

Please sign in to comment.