projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f9bc4a1
)
ASoC: max98373: Add checks for devm_kcalloc
author
Jiasheng Jiang
<jiasheng@iscas.ac.cn>
Wed, 16 Nov 2022 08:25:08 +0000
(16:25 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:41:03 +0000
(17:41 +0100)
[ Upstream commit
60591bbf6d5eb44f275eb733943b7757325c1b60
]
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: 349dd23931d1 ("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>
sound/soc/codecs/max98373-i2c.c
patch
|
blob
|
history
diff --git
a/sound/soc/codecs/max98373-i2c.c
b/sound/soc/codecs/max98373-i2c.c
index ddb6436835d737b14cbc451313af64c12bc57bf9..68497a4521dd2ccca40fc2cddc7f270e989cc39c 100644
(file)
--- a/
sound/soc/codecs/max98373-i2c.c
+++ b/
sound/soc/codecs/max98373-i2c.c
@@
-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];