Skip to content

Commit 60591bb

Browse files
JiangJiasbroonie
authored andcommitted
ASoC: max98373: Add checks for devm_kcalloc
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: 349dd23 ("ASoC: max98373: don't access volatile registers in bias level off") Signed-off-by: Jiasheng Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent c7d7d4e commit 60591bb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sound/soc/codecs/max98373-i2c.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,10 @@ static int max98373_i2c_probe(struct i2c_client *i2c)
549549
max98373->cache = devm_kcalloc(&i2c->dev, max98373->cache_num,
550550
sizeof(*max98373->cache),
551551
GFP_KERNEL);
552+
if (!max98373->cache) {
553+
ret = -ENOMEM;
554+
return ret;
555+
}
552556

553557
for (i = 0; i < max98373->cache_num; i++)
554558
max98373->cache[i].reg = max98373_i2c_cache_reg[i];

0 commit comments

Comments
 (0)