diff options
author | Markus Pargmann <mpa@pengutronix.de> | 2015-08-20 11:12:35 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-20 11:29:38 -0700 |
commit | 9a16ea900fadc88714e3a32214dea8e968ccd889 (patch) | |
tree | 7bdd07dee0ec12378c283d55b68ef404766813c2 /drivers/base/regmap | |
parent | bc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff) | |
download | blackbird-op-linux-9a16ea900fadc88714e3a32214dea8e968ccd889.tar.gz blackbird-op-linux-9a16ea900fadc88714e3a32214dea8e968ccd889.zip |
regmap: regmap_raw_read return error on !bus->read
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r-- | drivers/base/regmap/regmap.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 7111d04f2621..fc14a7cc8c85 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -2184,6 +2184,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); |