2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-26 22:24:09 +08:00

ASoC: smd845: fix memory leak

In case memory resources for *card* were allocated, release them before
return.

Addresses-Coverity-ID: 1472244 ("Resource leak")
Fixes: 6b1687bf76 ("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>
This commit is contained in:
Gustavo A. R. Silva 2018-08-03 08:42:11 -05:00 committed by Mark Brown
parent 26a6dce8ef
commit 8530ebf107
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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;
}