From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] regmap: cache: Do not panic for REGCACHE_NONE regmap
Date: Fri, 10 Mar 2023 08:39:10 +0100 [thread overview]
Message-ID: <20230310073911.3470892-1-alexander.stein@ew.tq-group.com> (raw)
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
next reply other threads:[~2023-03-10 7:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 7:39 Alexander Stein [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230310073911.3470892-1-alexander.stein@ew.tq-group.com \
--to=alexander.stein@ew.tq-group.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®