Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3905742f authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Greg Kroah-Hartman
Browse files

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: 457c25ef ("ASoC: rt5663: Add the function of impedance sensing")
Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20220225131030.27248-1-baijiaju1990@gmail.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a975000e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);