Skip to content

Commit fb25621

Browse files
Yuuoniybroonie
authored andcommitted
ASoC: fsl: Add missing error handling in pcm030_fabric_probe
Add the missing platform_device_put() and platform_device_del() before return from pcm030_fabric_probe in the error handling case. Fixes: c912fa9 ("ASoC: fsl: register the wm9712-codec") Signed-off-by: Miaoqian Lin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 8f2e5c6 commit fb25621

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sound/soc/fsl/pcm030-audio-fabric.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,21 @@ static int pcm030_fabric_probe(struct platform_device *op)
9393
dev_err(&op->dev, "platform_device_alloc() failed\n");
9494

9595
ret = platform_device_add(pdata->codec_device);
96-
if (ret)
96+
if (ret) {
9797
dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
98+
platform_device_put(pdata->codec_device);
99+
}
98100

99101
ret = snd_soc_register_card(card);
100-
if (ret)
102+
if (ret) {
101103
dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
104+
platform_device_del(pdata->codec_device);
105+
platform_device_put(pdata->codec_device);
106+
}
102107

103108
platform_set_drvdata(op, pdata);
104-
105109
return ret;
110+
106111
}
107112

108113
static int pcm030_fabric_remove(struct platform_device *op)

0 commit comments

Comments
 (0)