From ac95bdb9824699fd1196d91caa691afafcc0edf4 Mon Sep 17 00:00:00 2001 From: bui duc phuc Date: Wed, 15 Jul 2026 16:55:23 +0700 Subject: [PATCH] ASoC: sunxi: sun4i-spdif: Use dev_err_probe() for probe error handling Use dev_err_probe() for probe error handling to simplify the error paths and handle -EPROBE_DEFER correctly. Signed-off-by: bui duc phuc Reviewed-by: Chen-Yu Tsai Link: https://patch.msgid.link/20260715095525.40668-5-phucduc.bui@gmail.com Signed-off-by: Mark Brown --- sound/soc/sunxi/sun4i-spdif.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c index c2ec19437cd7..d979bb00312f 100644 --- a/sound/soc/sunxi/sun4i-spdif.c +++ b/sound/soc/sunxi/sun4i-spdif.c @@ -684,26 +684,23 @@ static int sun4i_spdif_probe(struct platform_device *pdev) host->regmap = devm_regmap_init_mmio(&pdev->dev, base, &sun4i_spdif_regmap_config); - if (IS_ERR(host->regmap)) { - dev_err(&pdev->dev, "failed to initialise regmap.\n"); - return PTR_ERR(host->regmap); - } + if (IS_ERR(host->regmap)) + return dev_err_probe(&pdev->dev, PTR_ERR(host->regmap), + "failed to initialise regmap.\n"); /* Clocks */ host->apb_clk = devm_clk_get(&pdev->dev, "apb"); - if (IS_ERR(host->apb_clk)) { - dev_err(&pdev->dev, "failed to get a apb clock.\n"); - return PTR_ERR(host->apb_clk); - } + if (IS_ERR(host->apb_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(host->apb_clk), + "failed to get a apb clock.\n"); if (quirks->tx_clk_name) tx_clk_name = quirks->tx_clk_name; host->spdif_clk = devm_clk_get(&pdev->dev, tx_clk_name); - if (IS_ERR(host->spdif_clk)) { - dev_err(&pdev->dev, "failed to get the \"%s\" clock.\n", - tx_clk_name); - return PTR_ERR(host->spdif_clk); - } + if (IS_ERR(host->spdif_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(host->spdif_clk), + "failed to get the \"%s\" clock.\n", + tx_clk_name); host->dma_params_tx.addr = res->start + quirks->reg_dac_txdata; host->dma_params_tx.maxburst = 8;