Skip to content

Commit 9ebd62d

Browse files
Yuuoniybroonie
authored andcommitted
ASoC: msm8916-wcd-analog: Fix error handling in pm8916_wcd_analog_spmi_probe
In the error handling path, the clk_prepare_enable() function call should be balanced by a corresponding 'clk_disable_unprepare()' call , as already done in the remove function. Fixes: de66b34 ("ASoC: codecs: msm8916-wcd-analog: add MBHC support") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Link: https://lore.kernel.org/r/20220316041924.17560-1-linmq006@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent e8ca4ce commit 9ebd62d

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

sound/soc/codecs/msm8916-wcd-analog.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,8 +1222,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
12221222
}
12231223

12241224
irq = platform_get_irq_byname(pdev, "mbhc_switch_int");
1225-
if (irq < 0)
1226-
return irq;
1225+
if (irq < 0) {
1226+
ret = irq;
1227+
goto err_disable_clk;
1228+
}
12271229

12281230
ret = devm_request_threaded_irq(dev, irq, NULL,
12291231
pm8916_mbhc_switch_irq_handler,
@@ -1235,8 +1237,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
12351237

12361238
if (priv->mbhc_btn_enabled) {
12371239
irq = platform_get_irq_byname(pdev, "mbhc_but_press_det");
1238-
if (irq < 0)
1239-
return irq;
1240+
if (irq < 0) {
1241+
ret = irq;
1242+
goto err_disable_clk;
1243+
}
12401244

12411245
ret = devm_request_threaded_irq(dev, irq, NULL,
12421246
mbhc_btn_press_irq_handler,
@@ -1247,8 +1251,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
12471251
dev_err(dev, "cannot request mbhc button press irq\n");
12481252

12491253
irq = platform_get_irq_byname(pdev, "mbhc_but_rel_det");
1250-
if (irq < 0)
1251-
return irq;
1254+
if (irq < 0) {
1255+
ret = irq;
1256+
goto err_disable_clk;
1257+
}
12521258

12531259
ret = devm_request_threaded_irq(dev, irq, NULL,
12541260
mbhc_btn_release_irq_handler,
@@ -1265,6 +1271,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
12651271
return devm_snd_soc_register_component(dev, &pm8916_wcd_analog,
12661272
pm8916_wcd_analog_dai,
12671273
ARRAY_SIZE(pm8916_wcd_analog_dai));
1274+
1275+
err_disable_clk:
1276+
clk_disable_unprepare(priv->mclk);
1277+
return ret;
12681278
}
12691279

12701280
static int pm8916_wcd_analog_spmi_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)