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


Groups > linux.kernel > #1324026 > unrolled thread

[PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read

Started byFabio Estevam <festevam@gmail.com>
First post2016-02-02 13:20 +0100
Last post2016-02-02 13:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read Fabio Estevam <festevam@gmail.com> - 2016-02-02 13:20 +0100
    Re: [PATCH 1/2] regmap: Return an error if a caller attempts to do  an unsupported raw read Mark Brown <broonie@kernel.org> - 2016-02-02 13:30 +0100

#1324026 — [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read

FromFabio Estevam <festevam@gmail.com>
Date2016-02-02 13:20 +0100
Subject[PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read
Message-ID<qXI66-2I0-11@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1324033 — Re: [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read

FromMark Brown <broonie@kernel.org>
Date2016-02-02 13:30 +0100
SubjectRe: [PATCH 1/2] regmap: Return an error if a caller attempts to do an unsupported raw read
Message-ID<qXIfM-2Pu-7@gated-at.bofh.it>
In reply to#1324026

[Multipart message — attachments visible in raw view] — view raw

On Tue, Feb 02, 2016 at 10:16:50AM -0200, Fabio Estevam wrote:
> 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.

I dropped this one into -next as soon as I wrote it...

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web