Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH] media: iris: use devm_mutex_init()
@ 2025-12-23 10:25 Bartosz Golaszewski
  2025-12-23 14:10 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Bartosz Golaszewski @ 2025-12-23 10:25 UTC (permalink / raw)
  To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
	Bryan O'Donoghue, Mauro Carvalho Chehab
  Cc: linux-media, linux-arm-msm, linux-kernel, Bartosz Golaszewski

Drop the call to mutex_destroy() in .remove() by using the managed API
in .probe().

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/media/platform/qcom/iris/iris_probe.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
index 9bc9b34c2576..0a4e7595a16e 100644
--- a/drivers/media/platform/qcom/iris/iris_probe.c
+++ b/drivers/media/platform/qcom/iris/iris_probe.c
@@ -202,8 +202,6 @@ static void iris_remove(struct platform_device *pdev)
 	video_unregister_device(core->vdev_enc);
 
 	v4l2_device_unregister(&core->v4l2_dev);
-
-	mutex_destroy(&core->lock);
 }
 
 static void iris_sys_error_handler(struct work_struct *work)
@@ -228,9 +226,12 @@ static int iris_probe(struct platform_device *pdev)
 	core->dev = dev;
 
 	core->state = IRIS_CORE_DEINIT;
-	mutex_init(&core->lock);
 	init_completion(&core->core_init_done);
 
+	ret = devm_mutex_init(core->dev, &core->lock);
+	if (ret)
+		return ret;
+
 	core->response_packet = devm_kzalloc(core->dev, IFACEQ_CORE_PKT_SIZE, GFP_KERNEL);
 	if (!core->response_packet)
 		return -ENOMEM;
-- 
2.47.3


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

* Re: [PATCH] media: iris: use devm_mutex_init()
  2025-12-23 10:25 [PATCH] media: iris: use devm_mutex_init() Bartosz Golaszewski
@ 2025-12-23 14:10 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2025-12-23 14:10 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
	Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media,
	linux-arm-msm, linux-kernel

On Tue, Dec 23, 2025 at 11:25:28AM +0100, Bartosz Golaszewski wrote:
> Drop the call to mutex_destroy() in .remove() by using the managed API
> in .probe().

You commit message should explain *why* you think this should be done.

mutex_destroy() doesn't free anything and is just used for a pretty
useless debugging feature. And devres is not free and increases runtime
memory consumption.

And you're also adding more lines than you are removing.

Johan

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

end of thread, other threads:[~2025-12-23 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23 10:25 [PATCH] media: iris: use devm_mutex_init() Bartosz Golaszewski
2025-12-23 14:10 ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox