From: Greg Kroah-Hartman Date: Wed, 29 Jan 2025 09:25:12 +0000 (+0100) Subject: 6.1-stable patches X-Git-Tag: v6.13.1~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=510c46cbfdd644ecf34ec5c006b7f99731af5d7a;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: regmap-detach-regmap-from-dev-on-regmap_exit.patch --- diff --git a/queue-6.1/regmap-detach-regmap-from-dev-on-regmap_exit.patch b/queue-6.1/regmap-detach-regmap-from-dev-on-regmap_exit.patch new file mode 100644 index 0000000000..4791b063c9 --- /dev/null +++ b/queue-6.1/regmap-detach-regmap-from-dev-on-regmap_exit.patch @@ -0,0 +1,61 @@ +From 3061e170381af96d1e66799d34264e6414d428a7 Mon Sep 17 00:00:00 2001 +From: Cosmin Tanislav +Date: Thu, 28 Nov 2024 15:16:23 +0200 +Subject: regmap: detach regmap from dev on regmap_exit + +From: Cosmin Tanislav + +commit 3061e170381af96d1e66799d34264e6414d428a7 upstream. + +At the end of __regmap_init(), if dev is not NULL, regmap_attach_dev() +is called, which adds a devres reference to the regmap, to be able to +retrieve a dev's regmap by name using dev_get_regmap(). + +When calling regmap_exit, the opposite does not happen, and the +reference is kept until the dev is detached. + +Add a regmap_detach_dev() function and call it in regmap_exit() to make +sure that the devres reference is not kept. + +Cc: stable@vger.kernel.org +Fixes: 72b39f6f2b5a ("regmap: Implement dev_get_regmap()") +Signed-off-by: Cosmin Tanislav +Rule: add +Link: https://lore.kernel.org/stable/20241128130554.362486-1-demonsingur%40gmail.com +Link: https://patch.msgid.link/20241128131625.363835-1-demonsingur@gmail.com +Signed-off-by: Mark Brown +Link: https://lore.kernel.org/r/20250115033244.2540522-1-tzungbi@kernel.org +Signed-off-by: Tzung-Bi Shih +Signed-off-by: Greg Kroah-Hartman +--- + drivers/base/regmap/regmap.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/drivers/base/regmap/regmap.c ++++ b/drivers/base/regmap/regmap.c +@@ -652,6 +652,17 @@ int regmap_attach_dev(struct device *dev + } + EXPORT_SYMBOL_GPL(regmap_attach_dev); + ++static int dev_get_regmap_match(struct device *dev, void *res, void *data); ++ ++static int regmap_detach_dev(struct device *dev, struct regmap *map) ++{ ++ if (!dev) ++ return 0; ++ ++ return devres_release(dev, dev_get_regmap_release, ++ dev_get_regmap_match, (void *)map->name); ++} ++ + static enum regmap_endian regmap_get_reg_endian(const struct regmap_bus *bus, + const struct regmap_config *config) + { +@@ -1536,6 +1547,7 @@ void regmap_exit(struct regmap *map) + { + struct regmap_async *async; + ++ regmap_detach_dev(map->dev, map); + regcache_exit(map); + regmap_debugfs_exit(map); + regmap_range_exit(map); diff --git a/queue-6.1/series b/queue-6.1/series index 06698ec20c..5e9608c35b 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -6,3 +6,4 @@ drm-amd-display-use-hw-lock-mgr-for-psr1.patch irqchip-sunxi-nmi-add-missing-skip_wake-flag.patch asoc-samsung-midas_wm1811-map-missing-jack-kcontrols.patch asoc-samsung-add-missing-depends-on-i2c.patch +regmap-detach-regmap-from-dev-on-regmap_exit.patch