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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251201092259.11761-1-johan@kernel.org>
Date: Mon,  1 Dec 2025 10:22:59 +0100
From: Johan Hovold <johan@...nel.org>
To: Srinivas Kandagatla <srini@...nel.org>,
	Mark Brown <broonie@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>,
	Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>,
	linux-sound@...r.kernel.org,
	linux-arm-msm@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Johan Hovold <johan@...nel.org>,
	Neil Armstrong <neil.armstrong@...aro.org>
Subject: [PATCH] ASoC: codecs: wcd939x-sdw: use devres for regmap allocation

Components are bound inside a new devres group so that any resources
allocated can be released on bind failure and on unbind without
affecting anything else.

Switch to using device managed regmap allocation for consistency while
dropping the misleading comment claiming that devres cannot be used.

Cc: Neil Armstrong <neil.armstrong@...aro.org>
Signed-off-by: Johan Hovold <johan@...nel.org>
---
 sound/soc/codecs/wcd939x-sdw.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/codecs/wcd939x-sdw.c b/sound/soc/codecs/wcd939x-sdw.c
index da342a0c95a5..399dfba79aa2 100644
--- a/sound/soc/codecs/wcd939x-sdw.c
+++ b/sound/soc/codecs/wcd939x-sdw.c
@@ -1384,12 +1384,7 @@ static int wcd9390_probe(struct sdw_slave *pdev, const struct sdw_device_id *id)
 	}
 
 	if (wcd->is_tx) {
-		/*
-		 * Do not use devres here since devres_release_group() could
-		 * be called by component_unbind() id the aggregate device
-		 * fails to bind.
-		 */
-		wcd->regmap = regmap_init_sdw(pdev, &wcd939x_regmap_config);
+		wcd->regmap = devm_regmap_init_sdw(pdev, &wcd939x_regmap_config);
 		if (IS_ERR(wcd->regmap))
 			return dev_err_probe(dev, PTR_ERR(wcd->regmap),
 					     "Regmap init failed\n");
@@ -1400,30 +1395,20 @@ static int wcd9390_probe(struct sdw_slave *pdev, const struct sdw_device_id *id)
 
 	ret = component_add(dev, &wcd_sdw_component_ops);
 	if (ret)
-		goto err_free_regmap;
+		return ret;
 
 	/* Set suspended until aggregate device is bind */
 	pm_runtime_set_suspended(dev);
 
 	return 0;
-
-err_free_regmap:
-	if (wcd->regmap)
-		regmap_exit(wcd->regmap);
-
-	return ret;
 }
 
 static int wcd9390_remove(struct sdw_slave *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct wcd939x_sdw_priv *wcd = dev_get_drvdata(dev);
 
 	component_del(dev, &wcd_sdw_component_ops);
 
-	if (wcd->regmap)
-		regmap_exit(wcd->regmap);
-
 	return 0;
 }
 
-- 
2.51.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ