clk: lmk04832: Don't disable vco clock on probe fail

The probe() method never calls clk_prepare_enable(), so it should not
call clk_disable_unprepare() for the vco.clk in the error path. Fixes
a "lmk-vco already disabled" BUG when probe fails.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Link: https://lore.kernel.org/r/20230802064100.15793-2-mike.looijmans@topic.nl
Reviewed-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
Mike Looijmans 2023-08-02 08:40:59 +02:00 committed by Stephen Boyd
parent f6d6c11f41
commit e63227c83c

View File

@ -1505,21 +1505,21 @@ static int lmk04832_probe(struct spi_device *spi)
ret = clk_set_rate(lmk->vco.clk, lmk->vco_rate); ret = clk_set_rate(lmk->vco.clk, lmk->vco_rate);
if (ret) { if (ret) {
dev_err(lmk->dev, "failed to set VCO rate\n"); dev_err(lmk->dev, "failed to set VCO rate\n");
goto err_disable_vco; goto err_disable_oscin;
} }
} }
ret = lmk04832_register_sclk(lmk); ret = lmk04832_register_sclk(lmk);
if (ret) { if (ret) {
dev_err(lmk->dev, "failed to init SYNC/SYSREF clock path\n"); dev_err(lmk->dev, "failed to init SYNC/SYSREF clock path\n");
goto err_disable_vco; goto err_disable_oscin;
} }
for (i = 0; i < info->num_channels; i++) { for (i = 0; i < info->num_channels; i++) {
ret = lmk04832_register_clkout(lmk, i); ret = lmk04832_register_clkout(lmk, i);
if (ret) { if (ret) {
dev_err(lmk->dev, "failed to register clk %d\n", i); dev_err(lmk->dev, "failed to register clk %d\n", i);
goto err_disable_vco; goto err_disable_oscin;
} }
} }
@ -1528,16 +1528,13 @@ static int lmk04832_probe(struct spi_device *spi)
lmk->clk_data); lmk->clk_data);
if (ret) { if (ret) {
dev_err(lmk->dev, "failed to add provider (%d)\n", ret); dev_err(lmk->dev, "failed to add provider (%d)\n", ret);
goto err_disable_vco; goto err_disable_oscin;
} }
spi_set_drvdata(spi, lmk); spi_set_drvdata(spi, lmk);
return 0; return 0;
err_disable_vco:
clk_disable_unprepare(lmk->vco.clk);
err_disable_oscin: err_disable_oscin:
clk_disable_unprepare(lmk->oscin); clk_disable_unprepare(lmk->oscin);