Skip to contentSkip to conversation

iio: trigger: add missing mutex_destroy in iio_trig_release

PATCH In review Ma Ke 3 participants 3 messages Nov 10, 2025 IIO

lore
Share & tools
lore

Ma Ke

author
#0 lore raw

PATCH v4 1/2 iio: trigger: add missing mutex_destroy in iio_trig_release

Add missing mutex_destroy() call in iio_trig_release() to properly clean up the mutex initialized in viio_trigger_alloc(). Ensure proper resource cleanup and follows kernel practices.

Found by code review.

---
Changes in v4:
- split the patch into two independent patches and modified according to developer's suggestions; Changes in v3:
- modified the patch;
Changes in v2:
- modified the patch, thanks for developer's suggestions.

---
 drivers/iio/industrialio-trigger.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/industrialio-trigger.c +1 -0
index 54416a384232..5baa83349e8f 100644
@@ -524,6 +524,7 @@ static void iio_trig_release(struct device *device)
 			       CONFIG_IIO_CONSUMERS_PER_TRIGGER);
 	}
 	kfree(trig->name);
+	mutex_destroy(&trig->pool_lock);
 	kfree(trig);
 }
 
Signature · 1 line
2.17.1
Reviewed-by on v4 1/2
#1 lore raw
Quoted 5 lines · Ma Ke

Add missing mutex_destroy() call in iio_trig_release() to properly clean up the mutex initialized in viio_trigger_alloc(). Ensure proper resource cleanup and follows kernel practices.

Found by code review.

First of all, the patches should form the series and include a cover letter, usually it can be done by running

git format-patch -v<X> --cover-letter --base ...

against the branch where changes are located on top of.

Then, here makes sense to add

The change otherwise LGTM (no need to resend this time),

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Reviewed-by on v4 1/2
#2 lore raw
In reply to Ma Ke
Quoted 7 lines · Ma Ke

Add missing mutex_destroy() call in iio_trig_release() to properly clean up the mutex initialized in viio_trigger_alloc(). Ensure proper resource cleanup and follows kernel practices.

Found by code review.

Quoted 8 lines

---
Changes in v4:
- split the patch into two independent patches and modified according to developer's suggestions; Changes in v3:
- modified the patch;
Changes in v2:
- modified the patch, thanks for developer's suggestions.
---

Quoted 15 lines

 drivers/iio/industrialio-trigger.c | 1 +

 1 file changed, 1 insertion(+)
drivers/iio/industrialio-trigger.c +1 -0
index 54416a384232..5baa83349e8f 100644
@@ -524,6 +524,7 @@ static void iio_trig_release(struct device *device)
  			       CONFIG_IIO_CONSUMERS_PER_TRIGGER);
  	}
  	kfree(trig->name);
+	mutex_destroy(&trig->pool_lock);
  	kfree(trig);
  }