Commit 863da1c1 authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Mark Brown

ASoC: mediatek: mt8195-afe-pcm: Simplify with dev_err_probe()

Shorten the probe function by switching to dev_err_probe() where
possible.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
Link: https://lore.kernel.org/r/20230503113413.149235-5-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org
parent 2ca0ec01
...@@ -3040,10 +3040,8 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -3040,10 +3040,8 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev)
struct snd_soc_component *component; struct snd_soc_component *component;
ret = of_reserved_mem_device_init(dev); ret = of_reserved_mem_device_init(dev);
if (ret) { if (ret)
dev_err(dev, "failed to assign memory region: %d\n", ret); return dev_err_probe(dev, ret, "failed to assign memory region\n");
return ret;
}
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(33)); ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(33));
if (ret) if (ret)
...@@ -3067,24 +3065,17 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -3067,24 +3065,17 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev)
/* initial audio related clock */ /* initial audio related clock */
ret = mt8195_afe_init_clock(afe); ret = mt8195_afe_init_clock(afe);
if (ret) { if (ret)
dev_err(dev, "init clock error\n"); return dev_err_probe(dev, ret, "init clock error\n");
return ret;
}
/* reset controller to reset audio regs before regmap cache */ /* reset controller to reset audio regs before regmap cache */
rstc = devm_reset_control_get_exclusive(dev, "audiosys"); rstc = devm_reset_control_get_exclusive(dev, "audiosys");
if (IS_ERR(rstc)) { if (IS_ERR(rstc))
ret = PTR_ERR(rstc); return dev_err_probe(dev, PTR_ERR(rstc), "could not get audiosys reset\n");
dev_err(dev, "could not get audiosys reset:%d\n", ret);
return ret;
}
ret = reset_control_reset(rstc); ret = reset_control_reset(rstc);
if (ret) { if (ret)
dev_err(dev, "failed to trigger audio reset:%d\n", ret); return dev_err_probe(dev, ret, "failed to trigger audio reset\n");
return ret;
}
spin_lock_init(&afe_priv->afe_ctrl_lock); spin_lock_init(&afe_priv->afe_ctrl_lock);
...@@ -3121,30 +3112,22 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) ...@@ -3121,30 +3112,22 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev)
ret = devm_request_irq(dev, irq_id, mt8195_afe_irq_handler, ret = devm_request_irq(dev, irq_id, mt8195_afe_irq_handler,
IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); IRQF_TRIGGER_NONE, "asys-isr", (void *)afe);
if (ret) { if (ret)
dev_err(dev, "could not request_irq for asys-isr\n"); return dev_err_probe(dev, ret, "could not request_irq for asys-isr\n");
return ret;
}
/* init sub_dais */ /* init sub_dais */
INIT_LIST_HEAD(&afe->sub_dais); INIT_LIST_HEAD(&afe->sub_dais);
for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) { for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) {
ret = dai_register_cbs[i](afe); ret = dai_register_cbs[i](afe);
if (ret) { if (ret)
dev_warn(dev, "dai register i %d fail, ret %d\n", return dev_err_probe(dev, ret, "dai cb%i register fail\n", i);
i, ret);
return ret;
}
} }
/* init dai_driver and component_driver */ /* init dai_driver and component_driver */
ret = mtk_afe_combine_sub_dai(afe); ret = mtk_afe_combine_sub_dai(afe);
if (ret) { if (ret)
dev_warn(dev, "mtk_afe_combine_sub_dai fail, ret %d\n", return dev_err_probe(dev, ret, "mtk_afe_combine_sub_dai fail\n");
ret);
return ret;
}
afe->mtk_afe_hardware = &mt8195_afe_hardware; afe->mtk_afe_hardware = &mt8195_afe_hardware;
afe->memif_fs = mt8195_memif_fs; afe->memif_fs = mt8195_memif_fs;
......
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