From: Geert Uytterhoeven Date: Thu, 5 Mar 2026 10:12:33 +0000 (+0100) Subject: clk: Simplify clk_is_match() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2369725b7eb43f70047418ac42e0e993412a4fd;p=thirdparty%2Fkernel%2Fstable.git 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 Reviewed-by: Brian Masney Signed-off-by: Stephen Boyd --- diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 47093cda9df3..1a73e9c4e752 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -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);