Commit 77e6a5e4 authored by Liu Jing's avatar Liu Jing Committed by Mark Brown

ASoC: mediatek: mt2701-cs42448: Optimize redundant code in mt2701_cs42448_machine_probe

Utilize the defined parameter 'dev' to make the code cleaner.
Signed-off-by: default avatarLiu Jing <liujing@cmss.chinamobile.com>
Reviewed-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
Link: https://patch.msgid.link/20240903093623.7120-1-liujing@cmss.chinamobile.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1324e5ff
...@@ -329,10 +329,10 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev) ...@@ -329,10 +329,10 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev)
int ret; int ret;
int i; int i;
struct device_node *platform_node, *codec_node, *codec_node_bt_mrg; struct device_node *platform_node, *codec_node, *codec_node_bt_mrg;
struct device *dev = &pdev->dev;
struct mt2701_cs42448_private *priv = struct mt2701_cs42448_private *priv =
devm_kzalloc(&pdev->dev, sizeof(struct mt2701_cs42448_private), devm_kzalloc(dev, sizeof(struct mt2701_cs42448_private),
GFP_KERNEL); GFP_KERNEL);
struct device *dev = &pdev->dev;
struct snd_soc_dai_link *dai_link; struct snd_soc_dai_link *dai_link;
if (!priv) if (!priv)
...@@ -341,7 +341,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev) ...@@ -341,7 +341,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev)
platform_node = of_parse_phandle(pdev->dev.of_node, platform_node = of_parse_phandle(pdev->dev.of_node,
"mediatek,platform", 0); "mediatek,platform", 0);
if (!platform_node) { if (!platform_node) {
dev_err(&pdev->dev, "Property 'platform' missing or invalid\n"); dev_err(dev, "Property 'platform' missing or invalid\n");
return -EINVAL; return -EINVAL;
} }
for_each_card_prelinks(card, i, dai_link) { for_each_card_prelinks(card, i, dai_link) {
...@@ -355,7 +355,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev) ...@@ -355,7 +355,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev)
codec_node = of_parse_phandle(pdev->dev.of_node, codec_node = of_parse_phandle(pdev->dev.of_node,
"mediatek,audio-codec", 0); "mediatek,audio-codec", 0);
if (!codec_node) { if (!codec_node) {
dev_err(&pdev->dev, dev_err(dev,
"Property 'audio-codec' missing or invalid\n"); "Property 'audio-codec' missing or invalid\n");
return -EINVAL; return -EINVAL;
} }
...@@ -368,7 +368,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev) ...@@ -368,7 +368,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev)
codec_node_bt_mrg = of_parse_phandle(pdev->dev.of_node, codec_node_bt_mrg = of_parse_phandle(pdev->dev.of_node,
"mediatek,audio-codec-bt-mrg", 0); "mediatek,audio-codec-bt-mrg", 0);
if (!codec_node_bt_mrg) { if (!codec_node_bt_mrg) {
dev_err(&pdev->dev, dev_err(dev,
"Property 'audio-codec-bt-mrg' missing or invalid\n"); "Property 'audio-codec-bt-mrg' missing or invalid\n");
return -EINVAL; return -EINVAL;
} }
...@@ -377,7 +377,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev) ...@@ -377,7 +377,7 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to parse audio-routing: %d\n", ret); dev_err(dev, "failed to parse audio-routing: %d\n", ret);
return ret; return ret;
} }
...@@ -395,10 +395,10 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev) ...@@ -395,10 +395,10 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev)
snd_soc_card_set_drvdata(card, priv); snd_soc_card_set_drvdata(card, priv);
ret = devm_snd_soc_register_card(&pdev->dev, card); ret = devm_snd_soc_register_card(dev, card);
if (ret) if (ret)
dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", dev_err(dev, "%s snd_soc_register_card fail %d\n",
__func__, ret); __func__, ret);
return ret; return ret;
} }
......
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