clk: Simplify clk_is_match()

Linux style is to handle early-on failure.  Inverting the first
condition lets us simplify the second, and improves readability.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
Geert Uytterhoeven
2026-03-05 11:12:33 +01:00
committed by Stephen Boyd
parent 5d6c477687
commit b2369725b7

View File

@@ -3259,11 +3259,10 @@ bool clk_is_match(const struct clk *p, const struct clk *q)
return true;
/* true if clk->core pointers match. Avoid dereferencing garbage */
if (!IS_ERR_OR_NULL(p) && !IS_ERR_OR_NULL(q))
if (p->core == q->core)
return true;
if (IS_ERR_OR_NULL(p) || IS_ERR_OR_NULL(q))
return false;
return false;
return p->core == q->core;
}
EXPORT_SYMBOL_GPL(clk_is_match);