aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen-Yu Tsai <[email protected]>2022-02-08 20:40:26 +0800
committerStephen Boyd <[email protected]>2022-02-17 12:12:24 -0800
commit203ce39ed50bed0fac716c7a811a67b1fcfde8d5 (patch)
tree8443540622183867a03142f8955c73fef8125587
parente938a13409884ed91ca35f3a09c71618800a797c (diff)
clk: mediatek: mux: Reverse check for existing clk to reduce nesting level
The clk registration code here currently does: if (IS_ERR_OR_NULL(clk_data->clks[mux->id])) { ... do clk registration ... } This extra level of nesting wastes screen real estate. Reduce the nesting level by reversing the conditional shown above. Other than that, functionality is not changed. Signed-off-by: Chen-Yu Tsai <[email protected]> Reviewed-by: Miles Chen <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Chun-Jie Chen <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
-rw-r--r--drivers/clk/mediatek/clk-mux.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/clk/mediatek/clk-mux.c b/drivers/clk/mediatek/clk-mux.c
index 01af6a52711a..70aa42144632 100644
--- a/drivers/clk/mediatek/clk-mux.c
+++ b/drivers/clk/mediatek/clk-mux.c
@@ -208,16 +208,17 @@ int mtk_clk_register_muxes(const struct mtk_mux *muxes,
for (i = 0; i < num; i++) {
const struct mtk_mux *mux = &muxes[i];
- if (IS_ERR_OR_NULL(clk_data->clks[mux->id])) {
- clk = mtk_clk_register_mux(mux, regmap, lock);
+ if (!IS_ERR_OR_NULL(clk_data->clks[mux->id]))
+ continue;
- if (IS_ERR(clk)) {
- pr_err("Failed to register clk %s: %pe\n", mux->name, clk);
- continue;
- }
+ clk = mtk_clk_register_mux(mux, regmap, lock);
- clk_data->clks[mux->id] = clk;
+ if (IS_ERR(clk)) {
+ pr_err("Failed to register clk %s: %pe\n", mux->name, clk);
+ continue;
}
+
+ clk_data->clks[mux->id] = clk;
}
return 0;