[PATCH v2] regmap: Check readable regs in _regmap_read
From: Michal Simek
Date: Mon Feb 10 2014 - 07:00:07 EST
Check if regs are readable.
Signed-off-by: Michal Simek <michal.simek@xxxxxxxxxx>
---
Changes in v2:
- Move checking below cache read
drivers/base/regmap/regmap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 6a19515..b897c1a 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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
--
1.8.2.3
Attachment:
pgp00000.pgp
Description: PGP signature