mirror of https://github.com/torvalds/linux.git
ASoC: fsl_xcvr: use dev_err_probe() replacing dev_err() + return
Use dev_err_probe() to simplify the code. This also silences -517 errors. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Link: https://patch.msgid.link/20251125101334.1596381-1-alexander.stein@ew.tq-group.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
80339b3823
commit
8ae28d0459
|
|
@ -1548,28 +1548,24 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
|
||||||
xcvr->soc_data = of_device_get_match_data(&pdev->dev);
|
xcvr->soc_data = of_device_get_match_data(&pdev->dev);
|
||||||
|
|
||||||
xcvr->ipg_clk = devm_clk_get(dev, "ipg");
|
xcvr->ipg_clk = devm_clk_get(dev, "ipg");
|
||||||
if (IS_ERR(xcvr->ipg_clk)) {
|
if (IS_ERR(xcvr->ipg_clk))
|
||||||
dev_err(dev, "failed to get ipg clock\n");
|
return dev_err_probe(dev, PTR_ERR(xcvr->ipg_clk),
|
||||||
return PTR_ERR(xcvr->ipg_clk);
|
"failed to get ipg clock\n");
|
||||||
}
|
|
||||||
|
|
||||||
xcvr->phy_clk = devm_clk_get(dev, "phy");
|
xcvr->phy_clk = devm_clk_get(dev, "phy");
|
||||||
if (IS_ERR(xcvr->phy_clk)) {
|
if (IS_ERR(xcvr->phy_clk))
|
||||||
dev_err(dev, "failed to get phy clock\n");
|
return dev_err_probe(dev, PTR_ERR(xcvr->phy_clk),
|
||||||
return PTR_ERR(xcvr->phy_clk);
|
"failed to get phy clock\n");
|
||||||
}
|
|
||||||
|
|
||||||
xcvr->spba_clk = devm_clk_get(dev, "spba");
|
xcvr->spba_clk = devm_clk_get(dev, "spba");
|
||||||
if (IS_ERR(xcvr->spba_clk)) {
|
if (IS_ERR(xcvr->spba_clk))
|
||||||
dev_err(dev, "failed to get spba clock\n");
|
return dev_err_probe(dev, PTR_ERR(xcvr->spba_clk),
|
||||||
return PTR_ERR(xcvr->spba_clk);
|
"failed to get spba clock\n");
|
||||||
}
|
|
||||||
|
|
||||||
xcvr->pll_ipg_clk = devm_clk_get(dev, "pll_ipg");
|
xcvr->pll_ipg_clk = devm_clk_get(dev, "pll_ipg");
|
||||||
if (IS_ERR(xcvr->pll_ipg_clk)) {
|
if (IS_ERR(xcvr->pll_ipg_clk))
|
||||||
dev_err(dev, "failed to get pll_ipg clock\n");
|
return dev_err_probe(dev, PTR_ERR(xcvr->pll_ipg_clk),
|
||||||
return PTR_ERR(xcvr->pll_ipg_clk);
|
"failed to get pll_ipg clock\n");
|
||||||
}
|
|
||||||
|
|
||||||
fsl_asoc_get_pll_clocks(dev, &xcvr->pll8k_clk,
|
fsl_asoc_get_pll_clocks(dev, &xcvr->pll8k_clk,
|
||||||
&xcvr->pll11k_clk);
|
&xcvr->pll11k_clk);
|
||||||
|
|
@ -1593,51 +1589,42 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
xcvr->regmap = devm_regmap_init_mmio_clk(dev, NULL, regs,
|
xcvr->regmap = devm_regmap_init_mmio_clk(dev, NULL, regs,
|
||||||
&fsl_xcvr_regmap_cfg);
|
&fsl_xcvr_regmap_cfg);
|
||||||
if (IS_ERR(xcvr->regmap)) {
|
if (IS_ERR(xcvr->regmap))
|
||||||
dev_err(dev, "failed to init XCVR regmap: %ld\n",
|
return dev_err_probe(dev, PTR_ERR(xcvr->regmap), "failed to init XCVR regmap\n");
|
||||||
PTR_ERR(xcvr->regmap));
|
|
||||||
return PTR_ERR(xcvr->regmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xcvr->soc_data->use_phy) {
|
if (xcvr->soc_data->use_phy) {
|
||||||
xcvr->regmap_phy = devm_regmap_init(dev, NULL, xcvr,
|
xcvr->regmap_phy = devm_regmap_init(dev, NULL, xcvr,
|
||||||
&fsl_xcvr_regmap_phy_cfg);
|
&fsl_xcvr_regmap_phy_cfg);
|
||||||
if (IS_ERR(xcvr->regmap_phy)) {
|
if (IS_ERR(xcvr->regmap_phy))
|
||||||
dev_err(dev, "failed to init XCVR PHY regmap: %ld\n",
|
return dev_err_probe(dev, PTR_ERR(xcvr->regmap_phy),
|
||||||
PTR_ERR(xcvr->regmap_phy));
|
"failed to init XCVR PHY regmap\n");
|
||||||
return PTR_ERR(xcvr->regmap_phy);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (xcvr->soc_data->pll_ver) {
|
switch (xcvr->soc_data->pll_ver) {
|
||||||
case PLL_MX8MP:
|
case PLL_MX8MP:
|
||||||
xcvr->regmap_pll = devm_regmap_init(dev, NULL, xcvr,
|
xcvr->regmap_pll = devm_regmap_init(dev, NULL, xcvr,
|
||||||
&fsl_xcvr_regmap_pllv0_cfg);
|
&fsl_xcvr_regmap_pllv0_cfg);
|
||||||
if (IS_ERR(xcvr->regmap_pll)) {
|
if (IS_ERR(xcvr->regmap_pll))
|
||||||
dev_err(dev, "failed to init XCVR PLL regmap: %ld\n",
|
return dev_err_probe(dev, PTR_ERR(xcvr->regmap_pll),
|
||||||
PTR_ERR(xcvr->regmap_pll));
|
"failed to init XCVR PLL regmap\n");
|
||||||
return PTR_ERR(xcvr->regmap_pll);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PLL_MX95:
|
case PLL_MX95:
|
||||||
xcvr->regmap_pll = devm_regmap_init(dev, NULL, xcvr,
|
xcvr->regmap_pll = devm_regmap_init(dev, NULL, xcvr,
|
||||||
&fsl_xcvr_regmap_pllv1_cfg);
|
&fsl_xcvr_regmap_pllv1_cfg);
|
||||||
if (IS_ERR(xcvr->regmap_pll)) {
|
if (IS_ERR(xcvr->regmap_pll))
|
||||||
dev_err(dev, "failed to init XCVR PLL regmap: %ld\n",
|
return dev_err_probe(dev, PTR_ERR(xcvr->regmap_pll),
|
||||||
PTR_ERR(xcvr->regmap_pll));
|
"failed to init XCVR PLL regmap\n");
|
||||||
return PTR_ERR(xcvr->regmap_pll);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(dev, "Error for PLL version %d\n", xcvr->soc_data->pll_ver);
|
return dev_err_probe(dev, -EINVAL,
|
||||||
return -EINVAL;
|
"Error for PLL version %d\n",
|
||||||
|
xcvr->soc_data->pll_ver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xcvr->reset = devm_reset_control_get_optional_exclusive(dev, NULL);
|
xcvr->reset = devm_reset_control_get_optional_exclusive(dev, NULL);
|
||||||
if (IS_ERR(xcvr->reset)) {
|
if (IS_ERR(xcvr->reset))
|
||||||
dev_err(dev, "failed to get XCVR reset control\n");
|
return dev_err_probe(dev, PTR_ERR(xcvr->reset),
|
||||||
return PTR_ERR(xcvr->reset);
|
"failed to get XCVR reset control\n");
|
||||||
}
|
|
||||||
|
|
||||||
/* get IRQs */
|
/* get IRQs */
|
||||||
irq = platform_get_irq(pdev, 0);
|
irq = platform_get_irq(pdev, 0);
|
||||||
|
|
@ -1645,17 +1632,13 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
|
||||||
return irq;
|
return irq;
|
||||||
|
|
||||||
ret = devm_request_irq(dev, irq, irq0_isr, 0, pdev->name, xcvr);
|
ret = devm_request_irq(dev, irq, irq0_isr, 0, pdev->name, xcvr);
|
||||||
if (ret) {
|
if (ret)
|
||||||
dev_err(dev, "failed to claim IRQ0: %i\n", ret);
|
return dev_err_probe(dev, ret, "failed to claim IRQ0\n");
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
rx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rxfifo");
|
rx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rxfifo");
|
||||||
tx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "txfifo");
|
tx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "txfifo");
|
||||||
if (!rx_res || !tx_res) {
|
if (!rx_res || !tx_res)
|
||||||
dev_err(dev, "could not find rxfifo or txfifo resource\n");
|
return dev_err_probe(dev, -EINVAL, "could not find rxfifo or txfifo resource\n");
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
xcvr->dma_prms_rx.chan_name = "rx";
|
xcvr->dma_prms_rx.chan_name = "rx";
|
||||||
xcvr->dma_prms_tx.chan_name = "tx";
|
xcvr->dma_prms_tx.chan_name = "tx";
|
||||||
xcvr->dma_prms_rx.addr = rx_res->start;
|
xcvr->dma_prms_rx.addr = rx_res->start;
|
||||||
|
|
@ -1678,8 +1661,7 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
|
||||||
ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
|
ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pm_runtime_disable(dev);
|
pm_runtime_disable(dev);
|
||||||
dev_err(dev, "failed to pcm register\n");
|
return dev_err_probe(dev, ret, "failed to pcm register\n");
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = devm_snd_soc_register_component(dev, &fsl_xcvr_comp,
|
ret = devm_snd_soc_register_component(dev, &fsl_xcvr_comp,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue