mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
Two clk driver fixes and a unit test fix:
- Terminate the of_device_id table in the Samsung exynosautov920 clk driver so that device matching logic doesn't run off the end of the array into other memory and break matching for any kernel with this driver loaded - Properly limit the max clk ID in the Rockchip clk driver - Use clk kunit helpers in the clk tests so that memory isn't leaked after the test concludes -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEE9L57QeeUxqYDyoaDrQKIl8bklSUFAmcRk/8RHHNib3lkQGtl cm5lbC5vcmcACgkQrQKIl8bklSVu4RAA2qKoXfSdElkgzpv5fW2Ydr0LbN5pS90B 4ey6QfVxco6imyvry/MVREIQVG0832otv1WMJ2D6kErCxvzo5bNf1vsXcg7h5Gci VJELgtgKUPkVC2S3UgXXJe7cTobZhDUoin/mfCXgHh1yk6rg5t0gElP+qrxto1qH Tan7cGpqW8CcK33M2BnYwS0LX1gSXQ3EN9R5opyIQGX6OFvBRXYk8GH8g3WTPBRt OtJoR3u7PZ95U3FfHuSGgTddD2r9ZlI0lCY95+RpDkF0cL2yIkVMU8GZHZH5DDpH iMGEFZ/QxC11BLjlleSPQsQJjPFJQ/lz7ZlJ8/c7zMFhmBusBu2Tk5aC8w7Dxa4o B1rErFxg63sFVTY1iC1gyaPYnNtIkIZe287YyIeO+Sr6aW6hEsLbDXtvfydAYJL1 w4wLwrOSgv9ncoEzaEnKoz62pgZbg/o3wB3fLLVrtBtdCaTZMSWRettHV1DdSLOZ gPQQtp6F0VgzW+ip7mPYYy+DKO5jErg1OtBmCszFgDvmKKDloHzaE9lP7j3YNFbm GaAaD/dM8muOJ+gvdVja/K2WEyFsec9vnABOGlb5LTmZtfHajrJl9jyaJ+9ILPi1 1xcWK5FH6m4NJygC7TcEUq5KZBZeEoe+9Z2hgIflX5XmL9aLeZOuGPvz6r2moICw ztsggsLsIYU= =EKY/ -----END PGP SIGNATURE----- Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux Pull clk fixes from Stephen Boyd: "Two clk driver fixes and a unit test fix: - Terminate the of_device_id table in the Samsung exynosautov920 clk driver so that device matching logic doesn't run off the end of the array into other memory and break matching for any kernel with this driver loaded - Properly limit the max clk ID in the Rockchip clk driver - Use clk kunit helpers in the clk tests so that memory isn't leaked after the test concludes" * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: test: Fix some memory leaks clk: rockchip: fix finding of maximum clock ID clk: samsung: Fix out-of-bound access of of_match_node()
This commit is contained in:
commit
d4b82e5808
@ -473,7 +473,7 @@ clk_multiple_parents_mux_test_init(struct kunit *test)
|
||||
&clk_dummy_rate_ops,
|
||||
0);
|
||||
ctx->parents_ctx[0].rate = DUMMY_CLOCK_RATE_1;
|
||||
ret = clk_hw_register(NULL, &ctx->parents_ctx[0].hw);
|
||||
ret = clk_hw_register_kunit(test, NULL, &ctx->parents_ctx[0].hw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -481,7 +481,7 @@ clk_multiple_parents_mux_test_init(struct kunit *test)
|
||||
&clk_dummy_rate_ops,
|
||||
0);
|
||||
ctx->parents_ctx[1].rate = DUMMY_CLOCK_RATE_2;
|
||||
ret = clk_hw_register(NULL, &ctx->parents_ctx[1].hw);
|
||||
ret = clk_hw_register_kunit(test, NULL, &ctx->parents_ctx[1].hw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -489,23 +489,13 @@ clk_multiple_parents_mux_test_init(struct kunit *test)
|
||||
ctx->hw.init = CLK_HW_INIT_PARENTS("test-mux", parents,
|
||||
&clk_multiple_parents_mux_ops,
|
||||
CLK_SET_RATE_PARENT);
|
||||
ret = clk_hw_register(NULL, &ctx->hw);
|
||||
ret = clk_hw_register_kunit(test, NULL, &ctx->hw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
clk_multiple_parents_mux_test_exit(struct kunit *test)
|
||||
{
|
||||
struct clk_multiple_parent_ctx *ctx = test->priv;
|
||||
|
||||
clk_hw_unregister(&ctx->hw);
|
||||
clk_hw_unregister(&ctx->parents_ctx[0].hw);
|
||||
clk_hw_unregister(&ctx->parents_ctx[1].hw);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test that for a clock with multiple parents, clk_get_parent()
|
||||
* actually returns the current one.
|
||||
@ -561,18 +551,18 @@ clk_test_multiple_parents_mux_set_range_set_parent_get_rate(struct kunit *test)
|
||||
{
|
||||
struct clk_multiple_parent_ctx *ctx = test->priv;
|
||||
struct clk_hw *hw = &ctx->hw;
|
||||
struct clk *clk = clk_hw_get_clk(hw, NULL);
|
||||
struct clk *clk = clk_hw_get_clk_kunit(test, hw, NULL);
|
||||
struct clk *parent1, *parent2;
|
||||
unsigned long rate;
|
||||
int ret;
|
||||
|
||||
kunit_skip(test, "This needs to be fixed in the core.");
|
||||
|
||||
parent1 = clk_hw_get_clk(&ctx->parents_ctx[0].hw, NULL);
|
||||
parent1 = clk_hw_get_clk_kunit(test, &ctx->parents_ctx[0].hw, NULL);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent1);
|
||||
KUNIT_ASSERT_TRUE(test, clk_is_match(clk_get_parent(clk), parent1));
|
||||
|
||||
parent2 = clk_hw_get_clk(&ctx->parents_ctx[1].hw, NULL);
|
||||
parent2 = clk_hw_get_clk_kunit(test, &ctx->parents_ctx[1].hw, NULL);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent2);
|
||||
|
||||
ret = clk_set_rate(parent1, DUMMY_CLOCK_RATE_1);
|
||||
@ -593,10 +583,6 @@ clk_test_multiple_parents_mux_set_range_set_parent_get_rate(struct kunit *test)
|
||||
KUNIT_ASSERT_GT(test, rate, 0);
|
||||
KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1 - 1000);
|
||||
KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_1 + 1000);
|
||||
|
||||
clk_put(parent2);
|
||||
clk_put(parent1);
|
||||
clk_put(clk);
|
||||
}
|
||||
|
||||
static struct kunit_case clk_multiple_parents_mux_test_cases[] = {
|
||||
@ -617,7 +603,6 @@ static struct kunit_suite
|
||||
clk_multiple_parents_mux_test_suite = {
|
||||
.name = "clk-multiple-parents-mux-test",
|
||||
.init = clk_multiple_parents_mux_test_init,
|
||||
.exit = clk_multiple_parents_mux_test_exit,
|
||||
.test_cases = clk_multiple_parents_mux_test_cases,
|
||||
};
|
||||
|
||||
@ -637,29 +622,20 @@ clk_orphan_transparent_multiple_parent_mux_test_init(struct kunit *test)
|
||||
&clk_dummy_rate_ops,
|
||||
0);
|
||||
ctx->parents_ctx[1].rate = DUMMY_CLOCK_INIT_RATE;
|
||||
ret = clk_hw_register(NULL, &ctx->parents_ctx[1].hw);
|
||||
ret = clk_hw_register_kunit(test, NULL, &ctx->parents_ctx[1].hw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ctx->hw.init = CLK_HW_INIT_PARENTS("test-orphan-mux", parents,
|
||||
&clk_multiple_parents_mux_ops,
|
||||
CLK_SET_RATE_PARENT);
|
||||
ret = clk_hw_register(NULL, &ctx->hw);
|
||||
ret = clk_hw_register_kunit(test, NULL, &ctx->hw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
clk_orphan_transparent_multiple_parent_mux_test_exit(struct kunit *test)
|
||||
{
|
||||
struct clk_multiple_parent_ctx *ctx = test->priv;
|
||||
|
||||
clk_hw_unregister(&ctx->hw);
|
||||
clk_hw_unregister(&ctx->parents_ctx[1].hw);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test that, for a mux whose current parent hasn't been registered yet and is
|
||||
* thus orphan, clk_get_parent() will return NULL.
|
||||
@ -912,7 +888,7 @@ clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate(st
|
||||
{
|
||||
struct clk_multiple_parent_ctx *ctx = test->priv;
|
||||
struct clk_hw *hw = &ctx->hw;
|
||||
struct clk *clk = clk_hw_get_clk(hw, NULL);
|
||||
struct clk *clk = clk_hw_get_clk_kunit(test, hw, NULL);
|
||||
struct clk *parent;
|
||||
unsigned long rate;
|
||||
int ret;
|
||||
@ -921,7 +897,7 @@ clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate(st
|
||||
|
||||
clk_hw_set_rate_range(hw, DUMMY_CLOCK_RATE_1, DUMMY_CLOCK_RATE_2);
|
||||
|
||||
parent = clk_hw_get_clk(&ctx->parents_ctx[1].hw, NULL);
|
||||
parent = clk_hw_get_clk_kunit(test, &ctx->parents_ctx[1].hw, NULL);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent);
|
||||
|
||||
ret = clk_set_parent(clk, parent);
|
||||
@ -931,9 +907,6 @@ clk_test_orphan_transparent_multiple_parent_mux_set_range_set_parent_get_rate(st
|
||||
KUNIT_ASSERT_GT(test, rate, 0);
|
||||
KUNIT_EXPECT_GE(test, rate, DUMMY_CLOCK_RATE_1);
|
||||
KUNIT_EXPECT_LE(test, rate, DUMMY_CLOCK_RATE_2);
|
||||
|
||||
clk_put(parent);
|
||||
clk_put(clk);
|
||||
}
|
||||
|
||||
static struct kunit_case clk_orphan_transparent_multiple_parent_mux_test_cases[] = {
|
||||
@ -961,7 +934,6 @@ static struct kunit_case clk_orphan_transparent_multiple_parent_mux_test_cases[]
|
||||
static struct kunit_suite clk_orphan_transparent_multiple_parent_mux_test_suite = {
|
||||
.name = "clk-orphan-transparent-multiple-parent-mux-test",
|
||||
.init = clk_orphan_transparent_multiple_parent_mux_test_init,
|
||||
.exit = clk_orphan_transparent_multiple_parent_mux_test_exit,
|
||||
.test_cases = clk_orphan_transparent_multiple_parent_mux_test_cases,
|
||||
};
|
||||
|
||||
@ -986,7 +958,7 @@ static int clk_single_parent_mux_test_init(struct kunit *test)
|
||||
&clk_dummy_rate_ops,
|
||||
0);
|
||||
|
||||
ret = clk_hw_register(NULL, &ctx->parent_ctx.hw);
|
||||
ret = clk_hw_register_kunit(test, NULL, &ctx->parent_ctx.hw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -994,7 +966,7 @@ static int clk_single_parent_mux_test_init(struct kunit *test)
|
||||
&clk_dummy_single_parent_ops,
|
||||
CLK_SET_RATE_PARENT);
|
||||
|
||||
ret = clk_hw_register(NULL, &ctx->hw);
|
||||
ret = clk_hw_register_kunit(test, NULL, &ctx->hw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -1060,7 +1032,7 @@ clk_test_single_parent_mux_set_range_disjoint_child_last(struct kunit *test)
|
||||
{
|
||||
struct clk_single_parent_ctx *ctx = test->priv;
|
||||
struct clk_hw *hw = &ctx->hw;
|
||||
struct clk *clk = clk_hw_get_clk(hw, NULL);
|
||||
struct clk *clk = clk_hw_get_clk_kunit(test, hw, NULL);
|
||||
struct clk *parent;
|
||||
int ret;
|
||||
|
||||
@ -1074,8 +1046,6 @@ clk_test_single_parent_mux_set_range_disjoint_child_last(struct kunit *test)
|
||||
|
||||
ret = clk_set_rate_range(clk, 3000, 4000);
|
||||
KUNIT_EXPECT_LT(test, ret, 0);
|
||||
|
||||
clk_put(clk);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1092,7 +1062,7 @@ clk_test_single_parent_mux_set_range_disjoint_parent_last(struct kunit *test)
|
||||
{
|
||||
struct clk_single_parent_ctx *ctx = test->priv;
|
||||
struct clk_hw *hw = &ctx->hw;
|
||||
struct clk *clk = clk_hw_get_clk(hw, NULL);
|
||||
struct clk *clk = clk_hw_get_clk_kunit(test, hw, NULL);
|
||||
struct clk *parent;
|
||||
int ret;
|
||||
|
||||
@ -1106,8 +1076,6 @@ clk_test_single_parent_mux_set_range_disjoint_parent_last(struct kunit *test)
|
||||
|
||||
ret = clk_set_rate_range(parent, 3000, 4000);
|
||||
KUNIT_EXPECT_LT(test, ret, 0);
|
||||
|
||||
clk_put(clk);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1238,7 +1206,6 @@ static struct kunit_suite
|
||||
clk_single_parent_mux_test_suite = {
|
||||
.name = "clk-single-parent-mux-test",
|
||||
.init = clk_single_parent_mux_test_init,
|
||||
.exit = clk_single_parent_mux_test_exit,
|
||||
.test_cases = clk_single_parent_mux_test_cases,
|
||||
};
|
||||
|
||||
|
@ -439,7 +439,7 @@ unsigned long rockchip_clk_find_max_clk_id(struct rockchip_clk_branch *list,
|
||||
if (list->id > max)
|
||||
max = list->id;
|
||||
if (list->child && list->child->id > max)
|
||||
max = list->id;
|
||||
max = list->child->id;
|
||||
}
|
||||
|
||||
return max;
|
||||
|
@ -1155,6 +1155,7 @@ static const struct of_device_id exynosautov920_cmu_of_match[] = {
|
||||
.compatible = "samsung,exynosautov920-cmu-peric0",
|
||||
.data = &peric0_cmu_info,
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct platform_driver exynosautov920_cmu_driver __refdata = {
|
||||
|
Loading…
Reference in New Issue
Block a user