mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] counter: ftm-quaddec: use devm_mutex_init()
@ 2026-05-23 18:43 Stepan Ionichev
  2026-05-31 22:34 ` William Breathitt Gray
  0 siblings, 1 reply; 2+ messages in thread
From: Stepan Ionichev @ 2026-05-23 18:43 UTC (permalink / raw)
  To: wbg; +Cc: patrick.havelange, peng.fan, linux-iio, linux-kernel, andy, sozdayvek

ftm_quaddec_probe() calls mutex_init() but neither the cleanup
action nor a remove callback issues a matching mutex_destroy(),
so the lock debug state is leaked on driver unbind.

Switch to devm_mutex_init() so the mutex is torn down in the same
devm scope it was set up in.

Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
---
 drivers/counter/ftm-quaddec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/counter/ftm-quaddec.c b/drivers/counter/ftm-quaddec.c
index c47741292..8455f16d6 100644
--- a/drivers/counter/ftm-quaddec.c
+++ b/drivers/counter/ftm-quaddec.c
@@ -292,7 +292,9 @@ static int ftm_quaddec_probe(struct platform_device *pdev)
 	counter->signals = ftm_quaddec_signals;
 	counter->num_signals = ARRAY_SIZE(ftm_quaddec_signals);
 
-	mutex_init(&ftm->ftm_quaddec_mutex);
+	ret = devm_mutex_init(&pdev->dev, &ftm->ftm_quaddec_mutex);
+	if (ret)
+		return ret;
 
 	ftm_quaddec_init(ftm);
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] counter: ftm-quaddec: use devm_mutex_init()
  2026-05-23 18:43 [PATCH] counter: ftm-quaddec: use devm_mutex_init() Stepan Ionichev
@ 2026-05-31 22:34 ` William Breathitt Gray
  0 siblings, 0 replies; 2+ messages in thread
From: William Breathitt Gray @ 2026-05-31 22:34 UTC (permalink / raw)
  To: Stepan Ionichev
  Cc: William Breathitt Gray, patrick.havelange, peng.fan, linux-iio,
	linux-kernel, andy


On Sat, 23 May 2026 23:43:51 +0500, Stepan Ionichev wrote:
> ftm_quaddec_probe() calls mutex_init() but neither the cleanup
> action nor a remove callback issues a matching mutex_destroy(),
> so the lock debug state is leaked on driver unbind.
> 
> Switch to devm_mutex_init() so the mutex is torn down in the same
> devm scope it was set up in.
> 
> [...]

Applied, thanks!

[1/1] counter: ftm-quaddec: use devm_mutex_init()
      commit: b400c076fe4b63576fa22fbb59078b030000970c

Best regards,
-- 
William Breathitt Gray <wbg@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-31 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-23 18:43 [PATCH] counter: ftm-quaddec: use devm_mutex_init() Stepan Ionichev
2026-05-31 22:34 ` William Breathitt Gray

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®