Skip to content

Commit a31414e

Browse files
YueHaibingbebarino
authored andcommitted
clk: tegra: Use match_string() helper to simplify the code
match_string() returns the array index of a matching string. Use it instead of the open-coded implementation. Signed-off-by: YueHaibing <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 097064b commit a31414e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/clk/tegra/clk-emc.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,20 +403,16 @@ static int load_one_timing_from_dt(struct tegra_clk_emc *tegra,
403403
}
404404

405405
timing->parent_index = 0xff;
406-
for (i = 0; i < ARRAY_SIZE(emc_parent_clk_names); i++) {
407-
if (!strcmp(emc_parent_clk_names[i],
408-
__clk_get_name(timing->parent))) {
409-
timing->parent_index = i;
410-
break;
411-
}
412-
}
413-
if (timing->parent_index == 0xff) {
406+
i = match_string(emc_parent_clk_names, ARRAY_SIZE(emc_parent_clk_names),
407+
__clk_get_name(timing->parent));
408+
if (i < 0) {
414409
pr_err("timing %pOF: %s is not a valid parent\n",
415410
node, __clk_get_name(timing->parent));
416411
clk_put(timing->parent);
417412
return -EINVAL;
418413
}
419414

415+
timing->parent_index = i;
420416
return 0;
421417
}
422418

0 commit comments

Comments
 (0)