mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ASoC: topology-test: Switch to snd_snd_component_new()
snd_soc_component_alloc() leaves the component object in uninitialized state. Switch to the constructor function to retrieve and operate on object in sane state. Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20261007133353.455185-5-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
857469990e
commit
c0e1ffec60
|
|
@ -246,8 +246,8 @@ static void snd_soc_tplg_test_load_with_null_comp(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component_null_comp);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ static void snd_soc_tplg_test_load_with_null_comp(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component_null_comp, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -291,8 +291,8 @@ static void snd_soc_tplg_test_load_with_null_ops(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ static void snd_soc_tplg_test_load_with_null_ops(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -355,8 +355,8 @@ static void snd_soc_tplg_test_load_with_null_fw(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component_null_fw);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ static void snd_soc_tplg_test_load_with_null_fw(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component_null_fw, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -406,8 +406,8 @@ static void snd_soc_tplg_test_load_empty_tplg(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -416,7 +416,7 @@ static void snd_soc_tplg_test_load_empty_tplg(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -464,8 +464,8 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_magic(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -474,7 +474,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_magic(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -522,8 +522,8 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_abi(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_abi(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -580,8 +580,8 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_size(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -590,7 +590,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_size(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -639,8 +639,8 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_payload_size(struct kunit *tes
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -649,7 +649,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_payload_size(struct kunit *tes
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -690,8 +690,8 @@ static void snd_soc_tplg_test_load_pcm_tplg(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -700,7 +700,7 @@ static void snd_soc_tplg_test_load_pcm_tplg(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
snd_soc_unregister_component(test_dev);
|
||||
|
|
@ -743,8 +743,8 @@ static void snd_soc_tplg_test_load_pcm_tplg_reload_comp(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -755,7 +755,7 @@ static void snd_soc_tplg_test_load_pcm_tplg_reload_comp(struct kunit *test)
|
|||
|
||||
for (i = 0; i < 100; i++) {
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
snd_soc_unregister_component(test_dev);
|
||||
|
|
@ -799,13 +799,13 @@ static void snd_soc_tplg_test_load_pcm_tplg_reload_card(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
/* run test */
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user