mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ASoC: max98373: Add checks for devm_kcalloc
[ Upstream commit60591bbf6d] As the devm_kcalloc may return NULL pointer, it should be better to check the return value in order to avoid NULL poineter dereference. Fixes:349dd23931("ASoC: max98373: don't access volatile registers in bias level off") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Link: https://lore.kernel.org/r/20221116082508.17418-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f9bc4a18e7
commit
bd419c7c68
@@ -551,6 +551,10 @@ static int max98373_i2c_probe(struct i2c_client *i2c,
|
||||
max98373->cache = devm_kcalloc(&i2c->dev, max98373->cache_num,
|
||||
sizeof(*max98373->cache),
|
||||
GFP_KERNEL);
|
||||
if (!max98373->cache) {
|
||||
ret = -ENOMEM;
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < max98373->cache_num; i++)
|
||||
max98373->cache[i].reg = max98373_i2c_cache_reg[i];
|
||||
|
||||
Reference in New Issue
Block a user