diff options
author | Jia-Ju Bai <baijiaju1990@gmail.com> | 2022-02-25 05:10:30 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-15 14:18:08 +0200 |
commit | 3905742f93b4c7232aab30e7b8c6ad7b9efc2d64 (patch) | |
tree | ed511a50fe7c3951497f38a2f680afaf7fb3ab93 /sound | |
parent | a975000e7aa358801ec64899b51a764ffe64501f (diff) | |
download | linux-stable-3905742f93b4c7232aab30e7b8c6ad7b9efc2d64.tar.gz linux-stable-3905742f93b4c7232aab30e7b8c6ad7b9efc2d64.tar.bz2 linux-stable-3905742f93b4c7232aab30e7b8c6ad7b9efc2d64.zip |
ASoC: rt5663: check the return value of devm_kzalloc() in rt5663_parse_dp()
[ Upstream commit 4d06f92f38b799295ae22c98be7a20cac3e2a1a7 ]
The function devm_kzalloc() in rt5663_parse_dp() can fail, so its return
value should be checked.
Fixes: 457c25efc592 ("ASoC: rt5663: Add the function of impedance sensing")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20220225131030.27248-1-baijiaju1990@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/rt5663.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index 3610be1590fc..19e2f622718d 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -3478,6 +3478,8 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) table_size = sizeof(struct impedance_mapping_table) * rt5663->pdata.impedance_sensing_num; rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL); + if (!rt5663->imp_table) + return -ENOMEM; ret = device_property_read_u32_array(dev, "realtek,impedance_sensing_table", (u32 *)rt5663->imp_table, table_size); |