Skip to content

Commit b236972

Browse files
geertubebarino
authored andcommitted
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>
1 parent 5d6c477 commit b236972

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/clk/clk.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3259,11 +3259,10 @@ bool clk_is_match(const struct clk *p, const struct clk *q)
32593259
return true;
32603260

32613261
/* true if clk->core pointers match. Avoid dereferencing garbage */
3262-
if (!IS_ERR_OR_NULL(p) && !IS_ERR_OR_NULL(q))
3263-
if (p->core == q->core)
3264-
return true;
3262+
if (IS_ERR_OR_NULL(p) || IS_ERR_OR_NULL(q))
3263+
return false;
32653264

3266-
return false;
3265+
return p->core == q->core;
32673266
}
32683267
EXPORT_SYMBOL_GPL(clk_is_match);
32693268

0 commit comments

Comments
 (0)