linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read
@ 2016-02-02 12:16 Fabio Estevam
  2016-02-02 12:16 ` [PATCH 2/2] regmap: cache: Fall back to register by register read for cache defaults Fabio Estevam
  2016-02-02 12:28 ` [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-02-02 12:16 UTC (permalink / raw)
  To: broonie; +Cc: mail, linux-kernel, Fabio Estevam

From: Mark Brown <broonie@kernel.org>

regmaps without raw I/O access can't implement raw I/O operations,
return an error if someone tries to do that rather than crashing.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 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 3432634..e2f6880 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2255,6 +2255,9 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 
 	WARN_ON(!map->bus);
 
+	if (!map->bus || !map->bus->read)
+		return -EINVAL;
+
 	range = _regmap_range_lookup(map, reg);
 	if (range) {
 		ret = _regmap_select_page(map, &reg, range,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read
@ 2016-02-01 21:38 Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-02-01 21:38 UTC (permalink / raw)
  To: mail, Fabio Estevam; +Cc: alsa-devel, nicoleotsuka, linux-kernel, Mark Brown

regmaps without raw I/O access can't implement raw I/O operations,
return an error if someone tries to do that rather than crashing.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 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 343263449aff..e2f68807d970 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2255,6 +2255,9 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 
 	WARN_ON(!map->bus);
 
+	if (!map->bus || !map->bus->read)
+		return -EINVAL;
+
 	range = _regmap_range_lookup(map, reg);
 	if (range) {
 		ret = _regmap_select_page(map, &reg, range,
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-02 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-02 12:16 [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read Fabio Estevam
2016-02-02 12:16 ` [PATCH 2/2] regmap: cache: Fall back to register by register read for cache defaults Fabio Estevam
2016-02-02 12:28 ` [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2016-02-01 21:38 Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).