regmap: Check readable regs in _regmap_read
authorMichal Simek <michal.simek@xilinx.com>
Mon, 10 Feb 2014 11:59:46 +0000 (12:59 +0100)
committerMark Brown <broonie@linaro.org>
Tue, 11 Feb 2014 16:38:47 +0000 (16:38 +0000)
Check if regs are readable.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/base/regmap/regmap.c

index 6a19515f8a458b3719fce7325f265a60a4d147a4..b897c1a88b560a8881fd2a88608ba801b0e45988 100644 (file)
@@ -1736,6 +1736,9 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
        if (map->cache_only)
                return -EBUSY;
 
+       if (!regmap_readable(map, reg))
+               return -EIO;
+
        ret = map->reg_read(context, reg, val);
        if (ret == 0) {
 #ifdef LOG_DEVICE