Commit 203ce39e authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Stephen Boyd
Browse files

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: default avatarChen-Yu Tsai <wenst@chromium.org>
Reviewed-by: default avatarMiles Chen <miles.chen@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220208124034.414635-24-wenst@chromium.org


Reviewed-by: default avatarChun-Jie Chen <chun-jie.chen@mediatek.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent e938a134
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -208,7 +208,9 @@ 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])) {
		if (!IS_ERR_OR_NULL(clk_data->clks[mux->id]))
			continue;

		clk = mtk_clk_register_mux(mux, regmap, lock);

		if (IS_ERR(clk)) {
@@ -218,7 +220,6 @@ int mtk_clk_register_muxes(const struct mtk_mux *muxes,

		clk_data->clks[mux->id] = clk;
	}
	}

	return 0;
}