From: Johan Hovold <johan@kernel.org>
To: Srinivas Kandagatla <srini@kernel.org>, Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>,
Ma Ke <make24@iscas.ac.cn>
Subject: [PATCH] ASoC: codecs: pm4125: clean up bind() device reference handling
Date: Fri, 19 Dec 2025 15:24:12 +0100 [thread overview]
Message-ID: <20251219142412.19043-1-johan@kernel.org> (raw)
A recent change fixed a couple of device leaks on component bind failure
and on unbind but did so in a confusing way by adding misleading
initialisations at bind() and bogus NULL checks at unbind().
Cc: Ma Ke <make24@iscas.ac.cn>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
sound/soc/codecs/pm4125.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/sound/soc/codecs/pm4125.c b/sound/soc/codecs/pm4125.c
index 8bc3b9994019..43dcafff6c77 100644
--- a/sound/soc/codecs/pm4125.c
+++ b/sound/soc/codecs/pm4125.c
@@ -1505,10 +1505,6 @@ static int pm4125_bind(struct device *dev)
struct device_link *devlink;
int ret;
- /* Initialize device pointers to NULL for safe cleanup */
- pm4125->rxdev = NULL;
- pm4125->txdev = NULL;
-
/* Give the soundwire subdevices some more time to settle */
usleep_range(15000, 15010);
@@ -1624,11 +1620,8 @@ static void pm4125_unbind(struct device *dev)
device_link_remove(dev, pm4125->rxdev);
device_link_remove(pm4125->rxdev, pm4125->txdev);
- /* Release device references acquired in bind */
- if (pm4125->txdev)
- put_device(pm4125->txdev);
- if (pm4125->rxdev)
- put_device(pm4125->rxdev);
+ put_device(pm4125->txdev);
+ put_device(pm4125->rxdev);
component_unbind_all(dev, pm4125);
}
--
2.51.2
next reply other threads:[~2025-12-19 14:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 14:24 Johan Hovold [this message]
2025-12-20 18:58 ` [PATCH] ASoC: codecs: pm4125: clean up bind() device reference handling Dmitry Baryshkov
2025-12-22 22:12 ` 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=20251219142412.19043-1-johan@kernel.org \
--to=johan@kernel.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=make24@iscas.ac.cn \
--cc=srini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.