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-next>] [day] [month] [year] [list]
Message-ID: <20150508095537.GA15394@opensource.wolfsonmicro.com>
Date:	Fri, 8 May 2015 10:55:37 +0100
From:	Nariman Poushin <nariman@...nsource.wolfsonmicro.com>
To:	broonie@...nel.org
Cc:	linux-kernel@...r.kernel.org, patches@...nsource.wolfsonmicro.com
Subject: [RFC][PATCH] regmap: make REGCACHE_NONE maps return error on
	regcache_sync

Signed-off-by: Nariman Poushin <nariman@...nsource.wolfsonmicro.com>
---
 regcache currently causes a BUG_ON if cache_sync/sync_region is
 called on a map with cache_type REGCACHE_NONE. This is not
 consistent with the behaviour of regcache_read/write which
 currently just return -ENOSYS and only throws a BUG_ON if
 the cache_type is something that _should_ have cache ops,
 but doesn't. Sure your device might not work, it but doesn't
 seem right to panic the kernel. The other option I suppose
 is to change it to a WARN_ON.

 Thanks
 Nariman

 drivers/base/regmap/regcache.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 7eb7b3b..992aba3 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -303,6 +303,9 @@ int regcache_sync(struct regmap *map)
 	const char *name;
 	unsigned int bypass;
 
+	if (map->cache_type == REGCACHE_NONE)
+		return -ENODEV;
+
 	BUG_ON(!map->cache_ops);
 
 	map->lock(map->lock_arg);
@@ -371,6 +374,9 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
 	const char *name;
 	unsigned int bypass;
 
+	if (map->cache_type == REGCACHE_NONE)
+		return -ENODEV;
+
 	BUG_ON(!map->cache_ops);
 
 	map->lock(map->lock_arg);
-- 
2.1.4

--
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