ASoC: max98373-sdw: add missing memory allocation check
We forgot to test that devm_kcalloc doesn't return NULL.
Fixes: 349dd23931 ('ASoC: max98373: don't access volatile registers in bias level off')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Link: https://lore.kernel.org/r/20210607222239.582139-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
c8a4556d98
commit
468a272ca4
@@ -786,6 +786,8 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap)
|
||||
max98373->cache = devm_kcalloc(dev, max98373->cache_num,
|
||||
sizeof(*max98373->cache),
|
||||
GFP_KERNEL);
|
||||
if (!max98373->cache)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < max98373->cache_num; i++)
|
||||
max98373->cache[i].reg = max98373_sdw_cache_reg[i];
|
||||
|
||||
Reference in New Issue
Block a user