ASoC: max98373: Add checks for devm_kcalloc
[sfrench/cifs-2.6.git] / sound / soc / codecs / max98373-i2c.c
index 3e04c7f0cce43bff93d981e7d38acd7ef88ee99a..ec0905df65d1847a7f366fd88fbb36d35fc3a4d4 100644 (file)
@@ -549,6 +549,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];