Skip to content

Commit

Permalink
clk: ti: dflt: fix enable_reg validity check
Browse files Browse the repository at this point in the history
The default clock enabling functions for TI clocks -
omap2_dflt_clk_enable() and omap2_dflt_clk_disable() perform a
NULL check for the enable_reg field of the clk_hw_omap structure.
This enable_reg field however is merely a combination of the index
of the master IP module, and the offset from the master IP module's
base address. A value of 0 is perfectly valid, and the current error
checking will fail in these cases. The issue was found when trying
to enable the iva2_ck clock on OMAP3 platforms.

So, switch the check to use IS_ERR. This correction is similar to the
logic used in commit c807dbe ("clk: ti: fix ti_clk_get_reg_addr
error handling").

Fixes: 9f37e90 ("clk: ti: dflt: move support for default gate clock..")
Signed-off-by: Suman Anna <[email protected]>
Signed-off-by: Tero Kristo <[email protected]>
  • Loading branch information
sumananna authored and Tero Kristo committed Oct 2, 2015
1 parent 19e7968 commit 7aba4f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/clk/ti/clkt_dflt.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ int omap2_dflt_clk_enable(struct clk_hw *hw)
}
}

if (unlikely(!clk->enable_reg)) {
if (unlikely(IS_ERR(clk->enable_reg))) {
pr_err("%s: %s missing enable_reg\n", __func__,
clk_hw_get_name(hw));
ret = -EINVAL;
Expand Down Expand Up @@ -264,7 +264,7 @@ void omap2_dflt_clk_disable(struct clk_hw *hw)
u32 v;

clk = to_clk_hw_omap(hw);
if (!clk->enable_reg) {
if (IS_ERR(clk->enable_reg)) {
/*
* 'independent' here refers to a clock which is not
* controlled by its parent.
Expand Down

0 comments on commit 7aba4f5

Please sign in to comment.