diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2018-08-03 08:42:11 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-08-03 15:46:34 +0100 |
commit | 8530ebf1079ccc84ffa32d970cdcae168b2f3684 (patch) | |
tree | ecb7b0ace7ce53e1454f58b89c87cfd3203e624f /sound/soc/qcom | |
parent | 26a6dce8ef99b0199e7682d1c203cf7d0b5fd5b0 (diff) | |
download | linux-rpi-8530ebf1079ccc84ffa32d970cdcae168b2f3684.tar.gz linux-rpi-8530ebf1079ccc84ffa32d970cdcae168b2f3684.tar.bz2 linux-rpi-8530ebf1079ccc84ffa32d970cdcae168b2f3684.zip |
ASoC: smd845: fix memory leak
In case memory resources for *card* were allocated, release them before
return.
Addresses-Coverity-ID: 1472244 ("Resource leak")
Fixes: 6b1687bf76ef ("ASoC: qcom: add sdm845 sound card support")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/qcom')
-rw-r--r-- | sound/soc/qcom/sdm845.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c index be0cb1122036..c1adb77230eb 100644 --- a/sound/soc/qcom/sdm845.c +++ b/sound/soc/qcom/sdm845.c @@ -222,8 +222,10 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev) /* Allocate the private data */ data = kzalloc(sizeof(*data), GFP_KERNEL); - if (!data) - return -ENOMEM; + if (!data) { + ret = -ENOMEM; + goto data_alloc_fail; + } card->dev = dev; dev_set_drvdata(dev, card); @@ -248,6 +250,7 @@ register_card_fail: kfree(card->dai_link); parse_dt_fail: kfree(data); +data_alloc_fail: kfree(card); return ret; } |