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 <phucduc.bui@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@kernel.org>
Link: https://patch.msgid.link/20260715095525.40668-5-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
bui duc phuc 2026-07-15 16:55:23 +07:00 committed by Mark Brown
parent 3e2262df84
commit ac95bdb982
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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;