summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-11-09 11:42:26 +0800
committerStephen Boyd <sboyd@kernel.org>2019-11-13 15:03:27 -0800
commita31414e8c98dadbe0d31804804090e78ab1e0e9f (patch)
treee1203a1198431ed2b589c9291388f012870c0bed /drivers
parent097064b841b74b137a7672e8daccd1384574ec9c (diff)
downloadlinux-a31414e8c98dadbe0d31804804090e78ab1e0e9f.tar.gz
linux-a31414e8c98dadbe0d31804804090e78ab1e0e9f.tar.bz2
linux-a31414e8c98dadbe0d31804804090e78ab1e0e9f.zip
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 <yuehaibing@huawei.com> Link: https://lkml.kernel.org/r/20191109034226.21044-1-yuehaibing@huawei.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/tegra/clk-emc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/clk/tegra/clk-emc.c b/drivers/clk/tegra/clk-emc.c
index ea39caf3d762..745f9faa98d8 100644
--- a/drivers/clk/tegra/clk-emc.c
+++ b/drivers/clk/tegra/clk-emc.c
@@ -403,20 +403,16 @@ static int load_one_timing_from_dt(struct tegra_clk_emc *tegra,
}
timing->parent_index = 0xff;
- for (i = 0; i < ARRAY_SIZE(emc_parent_clk_names); i++) {
- if (!strcmp(emc_parent_clk_names[i],
- __clk_get_name(timing->parent))) {
- timing->parent_index = i;
- break;
- }
- }
- if (timing->parent_index == 0xff) {
+ i = match_string(emc_parent_clk_names, ARRAY_SIZE(emc_parent_clk_names),
+ __clk_get_name(timing->parent));
+ if (i < 0) {
pr_err("timing %pOF: %s is not a valid parent\n",
node, __clk_get_name(timing->parent));
clk_put(timing->parent);
return -EINVAL;
}
+ timing->parent_index = i;
return 0;
}