Skip to content

Commit ddfd534

Browse files
tititiou36broonie
authored andcommitted
ASoC: codecs: Fix an error handling path in (rx|tx|va)_macro_probe()
After a successful lpass_macro_pds_init() call, lpass_macro_pds_exit() must be called. Add the missing call in the error handling path of the probe function and use it. Fixes: 9e3d83c ("ASoC: codecs: Add power domains support in digital macro codecs") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/5b5a015a9b1dc8011c6a4053fa49da1f2531e47c.1648969065.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent aa70527 commit ddfd534

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

sound/soc/codecs/lpass-rx-macro.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,12 +3566,16 @@ static int rx_macro_probe(struct platform_device *pdev)
35663566
return PTR_ERR(rx->pds);
35673567

35683568
base = devm_platform_ioremap_resource(pdev, 0);
3569-
if (IS_ERR(base))
3570-
return PTR_ERR(base);
3569+
if (IS_ERR(base)) {
3570+
ret = PTR_ERR(base);
3571+
goto err;
3572+
}
35713573

35723574
rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config);
3573-
if (IS_ERR(rx->regmap))
3574-
return PTR_ERR(rx->regmap);
3575+
if (IS_ERR(rx->regmap)) {
3576+
ret = PTR_ERR(rx->regmap);
3577+
goto err;
3578+
}
35753579

35763580
dev_set_drvdata(dev, rx);
35773581

@@ -3632,6 +3636,8 @@ static int rx_macro_probe(struct platform_device *pdev)
36323636
err_dcodec:
36333637
clk_disable_unprepare(rx->macro);
36343638
err:
3639+
lpass_macro_pds_exit(rx->pds);
3640+
36353641
return ret;
36363642
}
36373643

sound/soc/codecs/lpass-tx-macro.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,8 +1828,10 @@ static int tx_macro_probe(struct platform_device *pdev)
18281828
return PTR_ERR(tx->pds);
18291829

18301830
base = devm_platform_ioremap_resource(pdev, 0);
1831-
if (IS_ERR(base))
1832-
return PTR_ERR(base);
1831+
if (IS_ERR(base)) {
1832+
ret = PTR_ERR(base);
1833+
goto err;
1834+
}
18331835

18341836
/* Update defaults for lpass sc7280 */
18351837
if (of_device_is_compatible(np, "qcom,sc7280-lpass-tx-macro")) {
@@ -1846,8 +1848,10 @@ static int tx_macro_probe(struct platform_device *pdev)
18461848
}
18471849

18481850
tx->regmap = devm_regmap_init_mmio(dev, base, &tx_regmap_config);
1849-
if (IS_ERR(tx->regmap))
1850-
return PTR_ERR(tx->regmap);
1851+
if (IS_ERR(tx->regmap)) {
1852+
ret = PTR_ERR(tx->regmap);
1853+
goto err;
1854+
}
18511855

18521856
dev_set_drvdata(dev, tx);
18531857

@@ -1907,6 +1911,8 @@ static int tx_macro_probe(struct platform_device *pdev)
19071911
err_dcodec:
19081912
clk_disable_unprepare(tx->macro);
19091913
err:
1914+
lpass_macro_pds_exit(tx->pds);
1915+
19101916
return ret;
19111917
}
19121918

sound/soc/codecs/lpass-va-macro.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,8 +1434,10 @@ static int va_macro_probe(struct platform_device *pdev)
14341434
va->dmic_clk_div = VA_MACRO_CLK_DIV_2;
14351435
} else {
14361436
ret = va_macro_validate_dmic_sample_rate(sample_rate, va);
1437-
if (!ret)
1438-
return -EINVAL;
1437+
if (!ret) {
1438+
ret = -EINVAL;
1439+
goto err;
1440+
}
14391441
}
14401442

14411443
base = devm_platform_ioremap_resource(pdev, 0);
@@ -1492,6 +1494,8 @@ static int va_macro_probe(struct platform_device *pdev)
14921494
err_dcodec:
14931495
clk_disable_unprepare(va->macro);
14941496
err:
1497+
lpass_macro_pds_exit(va->pds);
1498+
14951499
return ret;
14961500
}
14971501

0 commit comments

Comments
 (0)