If we fail if a clk handle is NULL during initialization then there is no need to keep checking every time if the handle is NULL for enable/disable/set_32k/get_use_cnt. Signed-off-by: Omar Ramirez Luna <omar.ramirez@xxxxxx> --- drivers/dsp/bridge/services/clk.c | 54 +++++++++++-------------------------- 1 files changed, 16 insertions(+), 38 deletions(-) diff --git a/drivers/dsp/bridge/services/clk.c b/drivers/dsp/bridge/services/clk.c index 5ed6bb5..57cf6e3 100644 --- a/drivers/dsp/bridge/services/clk.c +++ b/drivers/dsp/bridge/services/clk.c @@ -132,7 +132,7 @@ bool services_clk_init(void) pr_err("%s: failed to get clk handle %s, dev id = %d\n", __func__, services_clks[i].clk_name, services_clks[i].id); - /* should we fail here?? */ + return false; } services_clks[i].clk_handle = clk_handle; i++; @@ -155,17 +155,11 @@ dsp_status services_clk_enable(IN enum services_clk_id clk_id) DBC_REQUIRE(clk_id < SERVICESCLK_NOT_DEFINED); clk_handle = services_clks[clk_id].clk_handle; - if (clk_handle) { - if (clk_enable(clk_handle)) { - pr_err("services_clk_enable: failed to Enable CLK %s, " - "CLK dev id = %d\n", - services_clks[clk_id].clk_name, - services_clks[clk_id].id); - status = DSP_EFAIL; - } - } else { - pr_err("%s: failed to get CLK %s, CLK dev id = %d\n", __func__, - services_clks[clk_id].clk_name, services_clks[clk_id].id); + if (clk_enable(clk_handle)) { + pr_err("services_clk_enable: failed to Enable CLK %s, " + "CLK dev id = %d\n", + services_clks[clk_id].clk_name, + services_clks[clk_id].id); status = DSP_EFAIL; } /* The SSI module need to configured not to have the Forced idle for @@ -195,13 +189,11 @@ dsp_status clk_set32k_hz(IN enum services_clk_id clk_id) DBC_REQUIRE(clk_id < SERVICESCLK_NOT_DEFINED); clk_handle = services_clks[clk_id].clk_handle; - if (clk_handle) { - if (!(clk_set_parent(clk_handle, clk_parent) == 0x0)) { - pr_err("%s: failed for %s, dev id = %d\n", __func__, - services_clks[clk_id].clk_name, - services_clks[clk_id].id); - status = DSP_EFAIL; - } + if (!(clk_set_parent(clk_handle, clk_parent) == 0x0)) { + pr_err("%s: failed for %s, dev id = %d\n", __func__, + services_clks[clk_id].clk_name, + services_clks[clk_id].id); + status = DSP_EFAIL; } return status; } @@ -233,36 +225,22 @@ dsp_status services_clk_disable(IN enum services_clk_id clk_id) if (clk_id == SERVICESCLK_SSI_ICK) ssi_clk_prepare(false); - if (clk_handle) { - clk_disable(clk_handle); - } else { - pr_err("services_clk_disable: failed to get CLK %s," - "CLK dev id = %d\n", - services_clks[clk_id].clk_name, - services_clks[clk_id].id); - status = DSP_EFAIL; - } + clk_disable(clk_handle); + return status; } s32 clk_get_use_cnt(IN enum services_clk_id clk_id) { - dsp_status status = DSP_SOK; struct clk *clk_handle; s32 use_count = -1; DBC_REQUIRE(clk_id < SERVICESCLK_NOT_DEFINED); clk_handle = services_clks[clk_id].clk_handle; - if (clk_handle) { - /* FIXME: usecount shouldn't be used */ - use_count = clk_handle->usecount; - } else { - pr_err("%s: failed to get %s, dev Id = %d\n", __func__, - services_clks[clk_id].clk_name, - services_clks[clk_id].id); - status = DSP_EFAIL; - } + /* FIXME: usecount shouldn't be used */ + use_count = clk_handle->usecount; + return use_count; } -- 1.6.2.4 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html