Commit f31a1710 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: simple-card-utils: accept NULL parameter on asoc_simple_card_xxx()

If simple-card-utils accept NULL pointer on asoc_simple_card_xxx(),
each driver code will be more simple.
Let's accept NULL pointer.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c0f4697c
...@@ -153,13 +153,17 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name); ...@@ -153,13 +153,17 @@ EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai) int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai)
{ {
return clk_prepare_enable(dai->clk); if (dai)
return clk_prepare_enable(dai->clk);
return 0;
} }
EXPORT_SYMBOL_GPL(asoc_simple_card_clk_enable); EXPORT_SYMBOL_GPL(asoc_simple_card_clk_enable);
void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai) void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai)
{ {
clk_disable_unprepare(dai->clk); if (dai)
clk_disable_unprepare(dai->clk);
} }
EXPORT_SYMBOL_GPL(asoc_simple_card_clk_disable); EXPORT_SYMBOL_GPL(asoc_simple_card_clk_disable);
...@@ -342,6 +346,9 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai, ...@@ -342,6 +346,9 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
{ {
int ret; int ret;
if (!simple_dai)
return 0;
if (simple_dai->sysclk) { if (simple_dai->sysclk) {
ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk,
simple_dai->clk_direction); simple_dai->clk_direction);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment