regmap: cache: fix errno in regcache_hw_init()
authorXiubo Li <Li.Xiubo@freescale.com>
Thu, 9 Oct 2014 09:02:54 +0000 (17:02 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 13 Oct 2014 10:47:54 +0000 (12:47 +0200)
When kmalloc() fails, we should return -ENOMEM.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regcache.c

index f1280dc..44e6a48 100644 (file)
@@ -44,7 +44,7 @@ static int regcache_hw_init(struct regmap *map)
                map->cache_bypass = 1;
                tmp_buf = kmalloc(map->cache_size_raw, GFP_KERNEL);
                if (!tmp_buf)
-                       return -EINVAL;
+                       return -ENOMEM;
                ret = regmap_raw_read(map, 0, tmp_buf,
                                      map->num_reg_defaults_raw);
                map->cache_bypass = cache_bypass;