summaryrefslogtreecommitdiff
path: root/sound/soc/qcom/lpass-apq8016.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2020-08-19 19:01:03 +0300
committerMark Brown <broonie@kernel.org>2020-08-20 22:30:33 +0300
commita467f2f8ad5f9a21f92b3fa6ad2aac90fa7054fe (patch)
tree5a211283f7e45e8130e6cbcbed378187f60d4bf8 /sound/soc/qcom/lpass-apq8016.c
parent1eb629363aa354e63f55f6680b0724165cf2088d (diff)
downloadlinux-a467f2f8ad5f9a21f92b3fa6ad2aac90fa7054fe.tar.xz
ASoC: qcom: add missing out of memory check on drvdata->clks allocation
Currently drvdata->clks is not being checked for an allocation failure, leading to potential null pointer dereferencing. Fix this by adding a check and returning -ENOMEM if an error occurred. Fixes: 1220f6a76e77 ("ASoC: qcom: Add common array to initialize soc based core clocks") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Rohit kumar <rohitkr@codeaurora.org> Addresses-Coverity: ("Dereference null return value") Link: https://lore.kernel.org/r/20200819160103.164893-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/qcom/lpass-apq8016.c')
-rw-r--r--sound/soc/qcom/lpass-apq8016.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index dd9e3dd014f6..5c8ae225cd5d 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -168,6 +168,8 @@ static int apq8016_lpass_init(struct platform_device *pdev)
drvdata->clks = devm_kcalloc(dev, variant->num_clks,
sizeof(*drvdata->clks), GFP_KERNEL);
+ if (!drvdata->clks)
+ return -ENOMEM;
drvdata->num_clks = variant->num_clks;
for (i = 0; i < drvdata->num_clks; i++)