ASoC: mediatek: mt8183: move card registration to the end of probe
mt8183_mt6358_ts3a227_max98357_dev_probe() does not return immediately if devm_snd_soc_register_card() returns fail. As a result, the rest of code still get executed. Two options to fix: 1. add an extra return statement if devm_snd_soc_register_card() returns fail 2. move devm_snd_soc_register_card() to the end of probe Adopt option 2 which is more clear and common. Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
108d0d40b9
commit
63ba8e4d04
@@ -331,7 +331,7 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
|
|||||||
struct device_node *platform_node;
|
struct device_node *platform_node;
|
||||||
struct snd_soc_dai_link *dai_link;
|
struct snd_soc_dai_link *dai_link;
|
||||||
struct pinctrl *default_pins;
|
struct pinctrl *default_pins;
|
||||||
int ret, i;
|
int i;
|
||||||
|
|
||||||
card->dev = &pdev->dev;
|
card->dev = &pdev->dev;
|
||||||
|
|
||||||
@@ -366,11 +366,6 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = devm_snd_soc_register_card(&pdev->dev, card);
|
|
||||||
if (ret)
|
|
||||||
dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n",
|
|
||||||
__func__, ret);
|
|
||||||
|
|
||||||
default_pins =
|
default_pins =
|
||||||
devm_pinctrl_get_select(&pdev->dev, PINCTRL_STATE_DEFAULT);
|
devm_pinctrl_get_select(&pdev->dev, PINCTRL_STATE_DEFAULT);
|
||||||
if (IS_ERR(default_pins)) {
|
if (IS_ERR(default_pins)) {
|
||||||
@@ -379,7 +374,7 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)
|
|||||||
return PTR_ERR(default_pins);
|
return PTR_ERR(default_pins);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return devm_snd_soc_register_card(&pdev->dev, card);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
#ifdef CONFIG_OF
|
||||||
|
|||||||
Reference in New Issue
Block a user