The maximum score that can be returned by of_device_is_compatible is OF_DEVICE_COMPATIBLE_MAX_SCORE. Once that score is returned, there is no point in continuing with the string comparisons, so just early exit. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- drivers/of/base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 8a42fcee1d40..b22959dabebf 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -717,6 +717,9 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches, if (score > best_score) { best_match = matches; best_score = score; + + if (score == OF_DEVICE_COMPATIBLE_MAX_SCORE) + break; } } -- 2.39.2