lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1321457302-8724-5-git-send-email-lars@metafoo.de>
Date:	Wed, 16 Nov 2011 16:28:20 +0100
From:	Lars-Peter Clausen <lars@...afoo.de>
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>,
	Jonathan Cameron <jic23@...nel.org>
CC:	Michael Hennerich <michael.hennerich@...log.com>,
	<linux-kernel@...r.kernel.org>, <linux-iio@...r.kernel.org>,
	<device-drivers-devel@...ckfin.uclinux.org>, <drivers@...log.com>,
	Lars-Peter Clausen <lars@...afoo.de>
Subject: [PATCH 5/7] regmap: Check if a register is writable instead of readable in regcache_read

One of the reasons for using a cache is to have a software shadow of a register
which is writable but not readable. This allows us to do a read-modify-write
operation on such a register.

Currently regcache checks whether a register is readable when performing a
cached read and returns an error if not. Change this check to test whether the
register is writable. This makes more sense, since reading from the cache when
the register is not readable allows the operation described above, but if the
register is not writable there shouldn't  be a value for it in the cache anyway.

Signed-off-by: Lars-Peter Clausen <lars@...afoo.de>
---
 drivers/base/regmap/regcache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 6f0dbc0..a004a7a 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -206,7 +206,7 @@ int regcache_read(struct regmap *map,
 
 	BUG_ON(!map->cache_ops);
 
-	if (!regmap_readable(map, reg))
+	if (!regmap_writeable(map, reg))
 		return -EIO;
 
 	if (!regmap_volatile(map, reg))
-- 
1.7.7.1


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ