From: Xiubo Li
Date: Thu, 9 Oct 2014 09:02:54 +0000 (+0800)
Subject: regmap: cache: fix errno in regcache_hw_init()
X-Git-Tag: v3.19-rc1~179^2~1^2~4
X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ba3f1c85a6e05e0ff90215d817249617fcbee523;p=karo-tx-linux.git
regmap: cache: fix errno in regcache_hw_init()
When kmalloc() fails, we should return -ENOMEM.
Signed-off-by: Xiubo Li
Signed-off-by: Mark Brown
---
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 7558e6b01c04..6bec659e35d9 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -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;