Skip to contentSkip to conversation

counter: ftm-quaddec: use devm_mutex_init()

PATCH Applied Stepan Ionichev 2 participants 2 messages May 23 – May 31

Subsystems (3)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 counter: ftm-quaddec: use devm_mutex_init()

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.

---
 drivers/counter/ftm-quaddec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/counter/ftm-quaddec.c +3 -1
index c47741292..8455f16d6 100644
@@ -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);
 
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Stepan Ionichev

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,

Signature · 1 line
William Breathitt Gray <[email protected]>