From f1a38bfdbbf4cee35f54c052c21a8ea7d821014a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: May 25 2023 07:19:32 +0000 Subject: regmap: cache: Return error in cache sync operations for REGCACHE_NONE (git-fixes). --- diff --git a/patches.suse/regmap-cache-Return-error-in-cache-sync-operations-f.patch b/patches.suse/regmap-cache-Return-error-in-cache-sync-operations-f.patch new file mode 100644 index 0000000..5df8798 --- /dev/null +++ b/patches.suse/regmap-cache-Return-error-in-cache-sync-operations-f.patch @@ -0,0 +1,48 @@ +From fd883d79e4dcd2417c2b80756f22a2ff03b0f6e0 Mon Sep 17 00:00:00 2001 +From: Alexander Stein +Date: Mon, 13 Mar 2023 08:18:11 +0100 +Subject: [PATCH] regmap: cache: Return error in cache sync operations for REGCACHE_NONE +Git-commit: fd883d79e4dcd2417c2b80756f22a2ff03b0f6e0 +Patch-mainline: v6.4-rc1 +References: git-fixes + +There is no sense in doing a cache sync on REGCACHE_NONE regmaps. +Instead of panicking the kernel due to missing cache_ops, return an error +to client driver. + +Signed-off-by: Alexander Stein +Link: https://lore.kernel.org/r/20230313071812.13577-1-alexander.stein@ew.tq-group.com +Signed-off-by: Mark Brown +Acked-by: Takashi Iwai + +--- + 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..8031007b4887 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 (WARN_ON(map->cache_type == REGCACHE_NONE)) ++ return -EINVAL; ++ + 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 (WARN_ON(map->cache_type == REGCACHE_NONE)) ++ return -EINVAL; ++ + BUG_ON(!map->cache_ops); + + map->lock(map->lock_arg); +-- +2.35.3 + diff --git a/series.conf b/series.conf index c3ce191..1e053ef 100644 --- a/series.conf +++ b/series.conf @@ -19854,6 +19854,7 @@ patches.suse/media-saa7134-fix-use-after-free-bug-in-saa7134_fini.patch patches.suse/media-rc-gpio-ir-recv-Fix-support-for-wake-up.patch patches.suse/media-venus-dec-Fix-handling-of-the-start-cmd.patch + patches.suse/regmap-cache-Return-error-in-cache-sync-operations-f.patch patches.suse/regulator-core-Shorten-off-on-delay-us-for-always-on.patch patches.suse/regulator-core-Consistently-set-mutex_owner-when-usi.patch patches.suse/regulator-core-Avoid-lockdep-reports-when-resolving-.patch