public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regmap: cache: Do not panic for REGCACHE_NONE regmap
@ 2023-03-10  7:39 Alexander Stein
  2023-03-10  7:39 ` [PATCH 2/2] regmap: cache: Fix return value Alexander Stein
  2023-03-10 13:02 ` [PATCH 1/2] regmap: cache: Do not panic for REGCACHE_NONE regmap Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Stein @ 2023-03-10  7:39 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, Rafael J . Wysocki
  Cc: Alexander Stein, linux-kernel

Most regcache operations do check for REGCACHE_NONE, before ensuring
doing BUG_ON(!map->cache_ops). The missing regcache_sync* functions
panic on REGCACHE_NONE regmaps instead. Add an early return for non-cached
ones.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 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 362e043e26d8..b61763dbfc68 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -349,6 +349,9 @@ int regcache_sync(struct regmap *map)
 	const char *name;
 	bool bypass;
 
+	if (map->cache_type == REGCACHE_NONE)
+		return 0;
+
 	BUG_ON(!map->cache_ops);
 
 	map->lock(map->lock_arg);
@@ -418,6 +421,9 @@ int regcache_sync_region(struct regmap *map, unsigned int min,
 	const char *name;
 	bool bypass;
 
+	if (map->cache_type == REGCACHE_NONE)
+		return 0;
+
 	BUG_ON(!map->cache_ops);
 
 	map->lock(map->lock_arg);
-- 
2.34.1


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

end of thread, other threads:[~2023-03-10 14:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10  7:39 [PATCH 1/2] regmap: cache: Do not panic for REGCACHE_NONE regmap Alexander Stein
2023-03-10  7:39 ` [PATCH 2/2] regmap: cache: Fix return value Alexander Stein
2023-03-10 13:02 ` [PATCH 1/2] regmap: cache: Do not panic for REGCACHE_NONE regmap Mark Brown
2023-03-10 13:35   ` Alexander Stein
2023-03-10 14:21     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox