Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210334

[PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read

From Markus Pargmann <mpa@pengutronix.de>
Newsgroups linux.kernel
Subject [PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read
Date 2015-08-20 11:20 +0200
Message-ID <pZuaT-wx-41@gated-at.bofh.it> (permalink)
References <pZuaR-wx-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Return -ENOTSUPP if map->bus->read is not implemented and we do not use
the cache. This code path would directly use bus->read would run into an
NULL pointer for the read function.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/base/regmap/regmap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index bb4e65e7a950..66efe25d64c9 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2201,6 +2201,11 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 
 	if (regmap_volatile_range(map, reg, val_count) || map->cache_bypass ||
 	    map->cache_type == REGCACHE_NONE) {
+		if (!map->bus->read) {
+			ret = -ENOTSUPP;
+			goto out;
+		}
+
 		/* Physical block read if there's no cache involved */
 		ret = _regmap_raw_read(map, reg, val, val_len);
 
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] regmap: fixes Markus Pargmann <mpa@pengutronix.de> - 2015-08-20 11:20 +0200
  [PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read Markus Pargmann <mpa@pengutronix.de> - 2015-08-20 11:20 +0200
    Re: [PATCH v2 4/5] regmap: regmap_raw_read return error on !bus->read Mark Brown <broonie@kernel.org> - 2015-08-20 20:40 +0200

csiph-web