[PATCH] clk: Simplify clk_is_match()
From: Geert Uytterhoeven
Date: Thu Mar 05 2026 - 05:18:52 EST
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@xxxxxxxxx>
---
drivers/clk/clk.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 47093cda9df32223..1a73e9c4e752a85c 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);
--
2.43.0