]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: Simplify clk_is_match()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 5 Mar 2026 10:12:33 +0000 (11:12 +0100)
committerStephen Boyd <sboyd@kernel.org>
Tue, 24 Mar 2026 00:19:12 +0000 (17:19 -0700)
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>
drivers/clk/clk.c

index 47093cda9df32223c1120c3710261296027c4cd3..1a73e9c4e752a85ce34ef2bfa52fbb4179f4f411 100644 (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);