Commit 8530ebf1 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Mark Brown

ASoC: smd845: fix memory leak

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

Addresses-Coverity-ID: 1472244 ("Resource leak")
Fixes: 6b1687bf ("ASoC: qcom: add sdm845 sound card support")
Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 26a6dce8
......@@ -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 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev)
kfree(card->dai_link);
parse_dt_fail:
kfree(data);
data_alloc_fail:
kfree(card);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment