Skip to content

Commit

Permalink
ASoC: fsl: Add missing error handling in pcm030_fabric_probe
Browse files Browse the repository at this point in the history
commit fb25621 upstream.

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 <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220127131336.30214-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Yuuoniy authored and gregkh committed Feb 8, 2022
1 parent 3e69837 commit 56e0747
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sound/soc/fsl/pcm030-audio-fabric.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,21 @@ static int pcm030_fabric_probe(struct platform_device *op)
dev_err(&op->dev, "platform_device_alloc() failed\n");

ret = platform_device_add(pdata->codec_device);
if (ret)
if (ret) {
dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
platform_device_put(pdata->codec_device);
}

ret = snd_soc_register_card(card);
if (ret)
if (ret) {
dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
platform_device_del(pdata->codec_device);
platform_device_put(pdata->codec_device);
}

platform_set_drvdata(op, pdata);

return ret;

}

static int pcm030_fabric_remove(struct platform_device *op)
Expand Down

0 comments on commit 56e0747

Please sign in to comment.